Jump to content

Task Status Update


Recommended Posts

Hi All,

I'm trying to create an event listener to update task statuses based on changes made to dependent statuses. For example, when render task is marked as "complete" the Comp task is changed to "Ready".

This is some of the code I have so far -

def InBetweens_Status (task, status):

    if status['name'] == "InProgress":
        Shot = task['parent']
        Render = Shot['children'][4]
        if Render['status']['name'] == "NotStarted":
            print "No change"
        if Render['status']['name'] == "InProgress":
            print "Do something"

def Update_Statuses(event):

   for entity in event['data'].get('entities', []):    
        if entity.get('entity_type') == 'Task' and entity['action'] == 'update':
            entity_Id = entity['entityId']
            task = session.get('Task',entity_Id)
            Status_Id = entity['changes']['statusid']['new']
            status = session.get('Status',Status_Id)
            InBetweens(task, status)

# Subscribe to events with the update topic.
session = ftrack_api.Session(auto_connect_event_hub=True)
session.event_hub.subscribe('topic=ftrack.update', Update_Statuses)

This works and gives me the status of the 'Render' task related to my 'InBetweens' task, however if I change that status and then update the status of the 'InBetweens' again it returns the original 'Render' status rather than the new one.

Any idea why this would be happening?

Thanks in advance,

Link to comment
Share on other sites

  • 2 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...