-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AY-7217_Add support to sync task assignees and statuses for all entities #113
Conversation
# Why? | ||
# if sg_event["entity_type"] == "Task": | ||
# log.info("Ignoring Task entity.") | ||
# return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, clearer communication was needed. A glitch in the AYON server caused the blockage. @fabiaserra, did it work when you tested it? Which server version are you using?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just tested it and it doesn't seem to be deleting the task even though it's logging as it is:
2024-06-24 14:20:37.849 INFO: Dispatched Ayon event with payload: {'type': 'EventLogEntry', 'id': 36954873, 'event_type': 'Shotgun_Task_Change', 'attribute_name': 'retirement_date', 'meta': {'type': 'attribute_change', 'attribute_name': 'retirement_date', 'entity_type': 'Task', 'entity_id': 113019, 'old_value': None, 'new_value': '2024-06-24 14:20:36 UTC'}, 'entity': None, 'user': {'id': 4556, 'name': 'Fabia Serra Arrizabalaga', 'type': 'HumanUser'}, 'project': {'id': 3909, 'name': 'dev_000', 'type': 'Project'}, 'session_uuid': 'cfb7b296-3234-11ef-bbc3-0a58a9feac02', 'created_at': '2024-06-24T14:20:36+00:00'}
2024-06-24 14:20:37.855 INFO: Dispatched Ayon event with payload: {'type': 'EventLogEntry', 'id': 36954874, 'event_type': 'Shotgun_Task_Retirement', 'attribute_name': None, 'meta': {'entity_type': 'Task', 'class_name': 'Task', 'entity_id': 113019, 'id': 113019, 'type': 'entity_retirement', 'retirement_date': '2024-06-24 14:20:36 UTC', 'display_name': 'light_comp'}, 'entity': None, 'user': {'id': 4556, 'name': 'Fabia Serra Arrizabalaga', 'type': 'HumanUser'}, 'project': {'id': 3909, 'name': 'dev_000', 'type': 'Project'}, 'session_uuid': None, 'created_at': '2024-06-24T14:20:36+00:00'}
2024-06-24 14:20:41.441 INFO: Running the Handler <module 'shotgrid_event'>
2024-06-24 14:20:41.924 INFO: Updating entity from SG event: attribute_change | Task | 113019
2024-06-24 14:20:42.100 WARNING: Entity Task <113019> no longer exists in ShotGrid, aborting...
2024-06-24 14:20:42.100 INFO: Event has been processed... setting to finished!
2024-06-24 14:20:42.144 INFO: Running the Handler <module 'shotgrid_event'>
2024-06-24 14:20:42.382 INFO: Removing entity from SG event: entity_retirement| Task | 113019
2024-06-24 14:20:42.558 INFO: Deleting AYON entity: <TaskEntity - 4b24d7702e5b11efbdd616d3d40dbae9>
2024-06-24 14:20:42.559 INFO: Event has been processed... setting to finished!
Can we fix it?
Resolved conflicts
Endpoint queries DB for user with matchin sg_user_id and uses its name as assignee
sg_entity.get(sg_attrib) might return empty ('' or []) which is valid value, so no need to query `sg_{sg_attrib}` which will be None. Solves completely removing tags from item in SG >> removing them in AYON
It assumes that users are synchronized with SG first, eg. they have data["sg_user_id"]
Fixed conflicts, translated SG user ids to AYON users and back. Tested synchronizations from SG>AYON and back, it seems to work. |
"Status with short name '%s' doesn't exist in project", status | ||
) | ||
else: | ||
try: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can check for scope of the status before you set it -> try except block would not be needed.
Co-authored-by: Jakub Trllo <[email protected]>
Co-authored-by: Jakub Trllo <[email protected]>
No need to expose user data unnecessary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Co-authored-by: Jakub Trllo <[email protected]>
Co-authored-by: Jakub Trllo <[email protected]>
Version couldnt be created in AYON yet.
Let test more before release. Thanks Fabia for contribution, even if it took a for while to review. |
Changelog Description
This adds support to sync task assignees to AYON tasks and statuses on all entities (including Versions)
Testing notes:
(^edited by kalisp)
original PR description kept for posterity
This adds support to sync task assignees to AYON tasks and statuses on all entities (including Versions)
This requires both of these PRs:
AY-7217