Jump to content

Fernando

Members
  • Posts

    33
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by Fernando

  1. Hello,

    Something that has eluded me for a while is how to quickly retrieve the assigned user(s) of a task in a query.
    The webapp seems to do this very quickly for a lot of tasks.
    image.png

    Is there a way to use projections to query a task and it's assigned user(s) directly?
    Currently after having queried a task we have to use its id to query the user like this:

    'User where assignments any (context_id is {id})'


    Is there a more efficient way?

    Cheers,
    Fernando

  2. Hello,

    We have encountered a small bug when querying the thumbnail of an object in a projection, for example:
     

    'select parent.name, parent.thumbnail_url, status.name, name from Task where parent.parent.name is "100 MAP" '

    The parent.thumbnail_url will throw an error:
     

    ftrack_api.exception.ServerError: Server reported error: AttributeError(type object 'Context' has
     no attribute 'thumbnail_url')

    Even though the follozing works in our case (the parent of the task is a shot that has a thumbnail):
    task['parent']['thumbnail_url']['url']

    It would be cool to directly get the thumbnail_url in our initial query, is there a reason why this doesn't work?

    Cheers,
    Fernando

  3. Hello,

    It appears that sometimes with a remove event the order of the parents will be wrong (starting from the current object being removed to the project)
    This happens when you remove an entity that contains other entities, for instance a Folder containing a Task and deleting the Folder.
    Here you can see the event for the task getting removed and the parents being out of order:

    {'action': 'remove',
     'changes': {'bid': {'new': None, 'old': 0.0},
                 'context_type': {'new': None, 'old': 'task'},
                 'created_by': {'new': None,
                                'old': '7304e7ca-6b30-4883-9ac3-2790e0f2863d'},
                 'description': {'new': None, 'old': ''},
                 'enddate': {'new': None, 'old': None},
                 'id': {'new': None, 'old': '9aa5e865-7166-4263-ad35-84235c29e8d6'},
                 'isopen': {'new': None, 'old': False},
                 'isrequirecomment': {'new': None, 'old': False},
                 'name': {'new': None, 'old': 'Task name'},
                 'object_typeid': {'new': None,
                                   'old': '11c137c0-ee7e-4f9c-91c5-8c77cec22b2c'},
                 'parent_id': {'new': None,
                               'old': 'ded66c29-a108-4040-8e4e-5c41277f3be8'},
                 'priorityid': {'new': None,
                                'old': '9661b320-3a0c-11e2-81c1-0800200c9a66'},
                 'project_id': {'new': None,
                                'old': '21ab25fe-1326-11ed-8f22-226b2eaee502'},
                 'showid': {'new': None,
                            'old': '21ab25fe-1326-11ed-8f22-226b2eaee502'},
                 'sort': {'new': None, 'old': 0.0},
                 'startdate': {'new': None, 'old': None},
                 'statusid': {'new': None,
                              'old': 'b8da42a6-d1fa-11ec-bd18-c2c2635a447b'},
                 'taskid': {'new': None,
                            'old': '9aa5e865-7166-4263-ad35-84235c29e8d6'},
                 'thumbid': {'new': None, 'old': None},
                 'typeid': {'new': None,
                            'old': 'eb42a444-cfca-11ed-bc56-8207c690cda3'}},
     'entityId': '9aa5e865-7166-4263-ad35-84235c29e8d6',
     'entityType': 'task',
     'entity_type': 'Task',
     'keys': ['id',
              'taskid',
              'thumbid',
              'created_at',
              'context_type',
              'name',
              'parent_id',
              'created_by',
              'bid',
              'description',
              'startdate',
              'enddate',
              'statusid',
              'typeid',
              'priorityid',
              'isopen',
              'isrequirecomment',
              'object_typeid',
              'showid',
              'sort',
              'project_id'],
     'objectTypeId': '11c137c0-ee7e-4f9c-91c5-8c77cec22b2c',
     'parentId': 'ded66c29-a108-4040-8e4e-5c41277f3be8',
     'parents': [{'entityId': '9aa5e865-7166-4263-ad35-84235c29e8d6',
                  'entityType': 'task',
                  'entity_type': 'Task',
                  'parentId': 'ded66c29-a108-4040-8e4e-5c41277f3be8'},
                 {'entityId': '21ab25fe-1326-11ed-8f22-226b2eaee502',
                  'entityType': 'show',
                  'entity_type': 'Project',
                  'parentId': None},
                 {'entityId': 'ded66c29-a108-4040-8e4e-5c41277f3be8',
                  'entityType': 'task',
                  'entity_type': 'Folder',
                  'parentId': '2019772d-e121-4537-95a0-ec86503e6bcc'},
                 {'entityId': '2019772d-e121-4537-95a0-ec86503e6bcc',
                  'entityType': 'task',
                  'entity_type': 'AssetBuild',
                  'parentId': '61cd032f-398a-4e80-98e2-0d137519c7a6'},
                 {'entityId': '61cd032f-398a-4e80-98e2-0d137519c7a6',
                  'entityType': 'task',
                  'entity_type': 'Folder',
                  'parentId': '88d47da3-369b-4190-8de0-01c4b63b6c3d'},
                 {'entityId': '88d47da3-369b-4190-8de0-01c4b63b6c3d',
                  'entityType': 'task',
                  'entity_type': 'Folder',
                  'parentId': '6cd61c6c-1d46-4fb3-9ed8-740407ce22e4'},
                 {'entityId': '6cd61c6c-1d46-4fb3-9ed8-740407ce22e4',
                  'entityType': 'task',
                  'entity_type': 'Folder',
                  'parentId': '21ab25fe-1326-11ed-8f22-226b2eaee502'}]}



    This is problematic for me because I was relying on parents[-1] being the project, while in this case the project is the second element of the list.
    Is this a bug, or should I not expect the parents to be in order?

  4. Hello,

    I believe we encountered a bug when filtering Due Dates of tasks.
    I set the Due Date of a task to 2023-05-09
    image.png.cd4629a509211f4cedd91e18c1491f96.png
    And then tried filtering with the following filter, but the task does not appear:image.thumb.png.0efb81b2030040e0454a37aab39014f3.png

    However, when I set the filter to "is not", the task does appear:
    image.png

    Am I misunderstanding something? To me it seems like the filter has a bug.

    Cheers,
    Fernando

     

  5. Hello,

    In the time sheet task drop down you can not select an assigned task that has been set to a "Done" state.
    I get why this is done, because otherwise the list of tasks would become very long during production.
    However, what would be the proper way to still log time for a task that was set to a "Done" status in the timesheet?
    Is it possible to still display "Done" tasks here?

    image.png.3f1b3f4d4ab39816c511fdd24e25a257.png

    Cheers,
    Fernando

  6. Hi Pat,

    It seems that the Update Task event isn't always generated when you change the assignee of a task (sometimes it is though). So while I would like to make it a feature request to add the old/new user ids in the changes of a Update Task event, it seems that it wont always work.
    I guess I do indeed need to work with Appointment events instead.

    Small side note: I never got a notification that you replied to my last message :) so my apologies for the late reply.

    Cheers,
    Fernando

  7. Hello,

    I'm trying to understand how a back-up of a project would work in ftrack. Could it be possible to restore a project to 24h hours ago?
    I've read this documentation: https://ftrack.zendesk.com/hc/en-us/articles/360005305477-Backups

    But we aren't running ftrack on-prem.

    We are switching to a full production in ftrack, and I would like to know how I could restore data if something went wrong, such as a user deleting entire entities by accident.
    Normally this shouldn't happen, but it's better to be prepared :)

    Cheers,
    Fernando

     

  8. Hello,

    I have created a custom object type called "Variant Category" and I would like to set its status without there being any underlying tasks.
    The idea is that this custom object will be linked to tasks and have a status that gets automatically updated if all linked tasks are set to final for example, but it won't have the tasks directly underneath it in the hierarchy view.

    image.png.dbc833a660cbec5114aebe93905a63e6.png

     

    image.png.d78e21c0d577c2ab4419e4331ecf0ee8.png

    As you can see in this example this "geometry" Variant Category is linked to tasks and I set the status to the lowest status of those tasks through the API ("in_progress" in this case)
    However, the Variant Category in the hierarchical view does not display the status since it is acting like a "folder object".
    Is it possible to create my own object type that handles like a task object? or alternatively - if that is not possible- can I create a task with a different icon than the classic task icon?
    Ideally I would want it to be a different type than a Task, to be able to quickly query all the objects of this type.

    I guess another solution would be to have a task underneath the Variant Category that is linked to all the other tasks instead, but this seems redundant.

    Cheers,
    Fernando

  9. Hello,

    Currently in the activities tab of a task, I can see changes of the following types: status/assignee/note/asset-published.
    Is it possible to also save other types of changes to the task, such as start-date/end-date changes and who made them in the activities tab?
    Could I do that through the API when catching an update task event?

    Cheers,
    Fernando

  10. Hi Erik,

    In your example you are accessing the user who made the change.
    What I am actually looking for is the new and old assigned user to a task.

    I now understand that I can find this information in the "appointment" add and remove event that also occur next to the task update entity within the event, but this is a very roundabout way of getting that info (I have to look at a different entity).
    Shouldn't the new and old user id be in the task update entity since 'userids' is one of the keys?

    Cheers,
    Fernando

  11. Hello,

    When I update a task assignee I can receive the following event:
     

    {'action': 'update',
     'changes': None,
     'entityId': '8c59f5de-6465-4144-9296-8990728e2baa',
     'entityType': 'task',
     'entity_type': 'Task',
     'keys': ['userids'],
     'objectTypeId': '11c137c0-ee7e-4f9c-91c5-8c77cec22b2c',
     'parentId': 'b1278ca3-619c-4743-9252-ffcdfdf1509d',
     'parents': [{'entityId': '8c59f5de-6465-4144-9296-8990728e2baa',
                  'entityType': 'task',
                  'entity_type': 'Task',
                  'parentId': 'b1278ca3-619c-4743-9252-ffcdfdf1509d'},
                 {'entityId': 'b1278ca3-619c-4743-9252-ffcdfdf1509d',
                  'entityType': 'task',
                  'entity_type': 'Shot',
                  'parentId': '98307db5-a299-4421-ac13-e6bdefb857d3'},
                 {'entityId': '98307db5-a299-4421-ac13-e6bdefb857d3',
                  'entityType': 'task',
                  'entity_type': 'Sequence',
                  'parentId': '571d57d2-0cad-4e38-9883-1707b81861ce'},
                 {'entityId': '571d57d2-0cad-4e38-9883-1707b81861ce',
                  'entityType': 'task',
                  'entity_type': 'Folder',
                  'parentId': 'b17dfa3f-fd34-47f2-b287-8978601c4f61'},
                 {'entityId': 'b17dfa3f-fd34-47f2-b287-8978601c4f61',
                  'entityType': 'task',
                  'entity_type': 'Folder',
                  'parentId': '5f90501e-1651-11ed-b371-4e9078e1c474'},
                 {'entityId': '5f90501e-1651-11ed-b371-4e9078e1c474',
                  'entityType': 'show',
                  'entity_type': 'Project',
                  'parentId': None}]}

    While I can deduce from the 'keys' value that the userids were changed, the 'changes' value is empty. I was expecting the 'old' and 'new' assigned userids to be stored there.
    Is there a way for me to retrieve the information of the old and newly assigned user?


    Cheers,
    Fernando

  12. Hello,

    I am currently subscribing to update events using

    session,event_hub.subscribe('topic=ftrack.update', handle_event)

    and I would like to only subscribe to events coming from a certain project, instead of receiving all ftrack update events. Is this possible?
    Is there somewhere where there is more information on the "topic" variable?

    Cheers,
    Fernando

  13. Hello,

    Is it possible to edit the order in which custom attributes are displayed for a certain entity?
    For example in this shot entity, I would like to display the Frame end below the Frame start.
    Is there a way to control the order of the custom attributes? I've tried manually dragging them in the settings but that does not seem to do anything.
    https://media.discordapp.net/attachments/968534773461032970/1015621031668498574/Screenshot_2022-09-03_at_15.54.33.png?width=415&height=708

    Cheers,
    Fernando

  14. Hi Patrick,

    Thanks for the answer, that will indeed be the case then.
    I've started using rollback() in case of an exception when committing and that seems to have solved the problem! So thank you so much for the hint.

    I have one more question regarding session.reset(), I thought I would use it to refresh my connection to the ftrack server every once and while (to avoid a timeout).
    Is this the correct thing to do, or is there another way to keep a connection from timing out?

    Cheers,
    Fernando
     

  15. My apologies for the late reply, this problem is a bit more complex then I thought it was.
    My initial problem statement is probably wrong: adding to the children does not create a problem.

    My actual problem seems to be that the ftrack server is returning errors that are not related to the current session.commit().
    For instance, an error will occur creating a certain task, and then I will receive the same error for hundreds of other updates/creation session.commit() requests.

    This is the error I receive that fails to create a shot task (above the doted line is just a json object of the message data):

    b'{"type":"shotTask","event":"create","data":{"obj":{"id":1046164,"stage":"compositing","shot":"070_0010","revision":{"id":1342158,"number":1,"date":"2022-08-24T08:27:10.182Z","author":5899},"name":"Compositing","status":"cancelled","user":null,"beginDate":null,"endDate":null,"dueDate":null,"bidDays":null,"spentDays":null,"customProperties":null,"_type":"shotTask","_postProcessed":true},"authorID":5899}}'
    -----------------------------
    Traceback (most recent call last):
      File "rabbitmq_receiver.py", line 340, in callback
        functions_dict[event+" "+type](json_object['data'])
      File "rabbitmq_receiver.py", line 168, in create_shot_task
        name, begin_date, end_date, due_date, priority, bid_days, user)
      File "/root/workspace/ftrack-scripts/src/ftrack_common_lib/ftrack_common.py", line 362, in ftrack_create_task
        session.commit()
      File "/usr/local/lib/python3.6/site-packages/ftrack_api/session.py", line 1308, in commit
        result = self.call(batch)
      File "/usr/local/lib/python3.6/site-packages/ftrack_api/session.py", line 1687, in call
        raise ftrack_api.exception.ServerError(error_message)
    ftrack_api.exception.ServerError: Server reported error: IntegrityError((MySQLdb._exceptions.IntegrityError) (1062, "Duplicate entry 'b45adbd0-4b7f-4f35-8f92-2c8dc0d5c215-Compositing (compositing)' for key 'context_parent_id_key'") [SQL: u'INSERT INTO context (context_type, name, parent_id, created_at, id, created_by_id) VALUES (%s, %s, %s, %s, %s, %s)'] [parameters: ('task', 'Compositing (compositing)', u'b45adbd0-4b7f-4f35-8f92-2c8dc0d5c215', datetime.datetime(2022, 8, 24, 9, 0, 1, 671123), u'41842636-ee23-4210-ab87-f72e8aafab2b', u'bcdf57b0-acc6-11e1-a554-f23c91df1211')] (Background on this error at: http://sqlalche.me/e/gkpj))

    And after this error occurs, I will receive the exact same error for hundreds of other server requests, that are unrelated to the previous shot task.
    for instance here is an asset task update request, that returns the same integrity error:

    b'{"type":"assetTask","event":"update","data":{"id":931987,"obj":{"id":931987,"asset":"cer_marigold","stage":"surfacing","variant":"default","revision":{"id":1342301,"number":6,"date":"2022-08-24T08:33:21.943Z","author":54887},"name":"Prop surfacing","status":"in_progress","user":"rolandf","beginDate":"2022-08-24","endDate":null,"dueDate":"2022-09-23","bidDays":null,"spentDays":null,"customProperties":null,"_type":"assetTask","_postProcessed":true},"existingObj":{"id":931987,"revision":{"id":1319613,"number":5,"date":"2022-08-18T07:25:07.939Z","author":16242},"asset":"cer_marigold","stage":"surfacing","variant":"default","name":"Prop surfacing","status":"ready_to_start","user":"rolandf","beginDate":null,"endDate":null,"dueDate":"2022-09-23","bidDays":null,"spentDays":null,"customProperties":null},"authorID":54887}}'
    -----------------------------
    Traceback (most recent call last):
      File "rabbitmq_receiver.py", line 340, in callback
        functions_dict[event+" "+type](json_object['data'])
      File "rabbitmq_receiver.py", line 42, in update_task
        end_date, due_date, task_name, task_type, new_user, bid_days, priority)
      File "/root/workspace/ftrack-scripts/src/ftrack_common_lib/ftrack_common.py", line 220, in ftrack_update_task
        session.commit()
      File "/usr/local/lib/python3.6/site-packages/ftrack_api/session.py", line 1308, in commit
        result = self.call(batch)
      File "/usr/local/lib/python3.6/site-packages/ftrack_api/session.py", line 1687, in call
        raise ftrack_api.exception.ServerError(error_message)
    ftrack_api.exception.ServerError: Server reported error: IntegrityError((MySQLdb._exceptions.IntegrityError) (1062, "Duplicate entry 'b45adbd0-4b7f-4f35-8f92-2c8dc0d5c215-Compositing (compositing)' for key 'context_parent_id_key'") [SQL: u'INSERT INTO context (context_type, name, parent_id, created_at, id, created_by_id) VALUES (%s, %s, %s, %s, %s, %s)'] [parameters: ('task', 'Compositing (compositing)', u'b45adbd0-4b7f-4f35-8f92-2c8dc0d5c215', datetime.datetime(2022, 8, 24, 9, 0, 4, 166823), u'41842636-ee23-4210-ab87-f72e8aafab2b', u'bcdf57b0-acc6-11e1-a554-f23c91df1211')] (Background on this error at: http://sqlalche.me/e/gkpj))

    So my first question is how could this be happening? why would the server still return the same error?
    My second question will be why the first shot task creation even fails: it is not possible that this task already exists. Is there any way to get more information on this "integrity error"?

    I've also attached a py file containing my two functions to create and update an ftrack task, maybe that can help to identify the problem.

    Cheers,
    Fernando

    ftrackcreatetask.py

  16. I got it to work how you suggested: It wasn't clear that I really needed to change the value to seconds to have a high enough number that gets reinterpreted to 5.00 days.
    The documentation made it seem that I just had to write the number of days to that value.

    Thank you for your answer!

    Cheers,
    Fernando

×
×
  • Create New...