Duncan Posted October 7, 2019 Report Share Posted October 7, 2019 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) session.event_hub.wait() 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 More sharing options...
Lorenzo Angeli Posted October 8, 2019 Report Share Posted October 8, 2019 Hi @Duncan, if you want to have statuses changes to persist, you have to remember to commit your session. Overall you can find a similar example on our recipes repository. Hope it helps. L. Link to comment Share on other sites More sharing options...
Duncan Posted October 9, 2019 Author Report Share Posted October 9, 2019 Ah, I hadn't seen that example. I'll take a look at that. Thanks very much. Link to comment Share on other sites More sharing options...
Jason Evanko Posted July 2, 2022 Report Share Posted July 2, 2022 Hey Duncan! were you able to get this working properly? I'm trying to do it myself as well and am running into some issues on some types of status'. Thanks so much! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now