Shotgrid Integration addon

Alright. Thank you for your reply. So I guess the best way to get around that would be with some hardcoded parts inside the project anatomy, right?

I am assuming you mean SG to AYON direction of the sync, in that case, no matter what you define in AYON, the SG hierarchy would be respected and it would most likely ignore your paths, feel free to add images or maybe “tree” of the hierarchies (in both AYON and SG) that you want and I might be able to help further.

I think this post is related to the post’s topic.

Hello everyone,

Targeting a specific folder in Ayon according to the sg_type/sg_asset_type field is indeed a much needed feature :heart_eyes:
I did that in the past few days, its working quite nicely and gets along the Asset Category feature seamlessly.

There’s a new folder type you need to add TargetFolder
and a new attribute targetFolder
(Not the best names, do you guys have suggestions ?)

Here is a screen, new Episode / Sequence / AssetCategory from Shotgrid will be parented to the desired TargetFolder:

note: Sequences are not under Episodes because I let the hierarchy flat in Shotgrid.

If your project’s tracking settings say otherwise, they will appear under the right entity (if properly provided)
(ex: Episode > Sequence > Shot) :


I tested with the Sync Project and the ShotgridLeecher service via Ash.


Rules :

The new TargetFolder type will be added automatically if it does not already exist.

Shotgrid parent or AssetCategory will always have the priority over TargetFolder.

Works when doing a full synchro and with the ShotgridLeecher service.


Don’t hesitate to try it out and give feedback :wink:
Here is the branch (you will need to zip the addon and build docker images for the services):

1 Like

@Minkiu I finally got around to trying the new addon and it fixed the issue we were hitting on the sync which is great :slight_smile:
However, when trying to publish a model from maya, I am hitting an error on the collect_shotgrd_session plugin indicating that the AYON_SG_USERNAME variable isn’t set and that I need to log in from the ayon tray. WIth the new addon it seems like it’s no longer possible to log in from the tray and my understanding was that authentication was supposed to happen with the api key. Do you know what might be up here?

Thanks!

They removed the user login in favor of using the script for publishing as well, though something broke mid-way through.
Ref. Discord

Thanks for the link Alfonso, this is exactly our error :slight_smile:
I’m a bit unclear from the thread whether this is a bug or if we’re expected to be handling the setting of AYON_SG_USERNAME on our end…guess I will wait for updates there

The idea behind that is that you would have control on specifying that environment variable per user as pleased so artists don’t have to log in multiple different places and also workaround the limitation of enabling 2FA authentication in Shotgrid users. In our case the SG user names is currently exactly the same as $USER on our workstation environments so on the General Environment in the Ayon core addon I’m setting the following:

Screenshot 2024-02-12 at 5.20.09 PM

Ideally that username would match the same as the Ayon username and so that could also be an option where you make that AYON_SG_USERNAME come from the user that’s logged in the Ayon server, although that would probably not work remotely in the farm as that connection is happening with the service user and not the user, that’s why using an env var is easier as you can just pass that env var to the Deadline job.

On any case, I agree that we should provide the documentation in the addon on how to control this

That makes sense, thanks for the clarification!

One more question – we’re hitting an error on the integration of Published Files due to apparent lack of configured local storage, although we do actually have one defined on the site. From looking at the plugin, it seems like it comes down to the publish instance’s localStorageKey returning as None (instance.context.data[“shotgridLocalStorageKey”]). Does somebody know where this key is supposed to be defined? I had assumed it was the Shotgrid Local Storage entry name in the shotgrid addon settings, but that doesn’t seem to have worked.
image

it should be that entry on the settings called Shotgrid local storage entry name yeah, perhaps there’s a bug on the collect_shotgrid_session plugin. You can check the log of that plugin and you should see an info log saying something like this:
Using local storage entry ayon_primary

However, I actually disabled the shotgrid local storage option in my case as I realized that Shotgrid automatically already replaces the given publish path to the local storage if it finds the root on the path so you might not need it either

Hey @fabiaserra , quick basic question- how do you pass the env var to the deadline job? I’m sure this is documented somewhere but can’t find it. Ideally I’m imagining setting Ayon usernames to be the same as SG user names, and passing these as the AYON_SG_USERNAME to deadline.

Hey @reecemulley , it depends from where you submit the Deadline job but if you are relying on OP’s Deadline submission and you mean on the Ayon publish job it’s going to be here if you are still relying on the OP addon: https://github.com/ynput/OpenPype/blob/b49e4245db8dbd6ecf618a6a7932c664211e5833/openpype/modules/deadline/plugins/publish/submit_publish_job.py#L114 It’s reallly not documented and the @ynput team should make that more straightforward and finish providing an easier solution for SG.

Hey again, sorry for taking so long to get back to you, had to put this on pause for a little bit.
I’ve followed mustafa_jafar’s community guide on Deadline setup, copying the openpype deadline “custom” directory into the deadline repository. As this directory isn’t available through the docker deployment I downloaded the ayon-core repository and stole it from there.
However these modifications to the publish plugins are something else entirely, how do I deploy this? Apologies if this is super basic or already documented

I think I didn’t get your question.
also, is it related to SG addon ? (if not, could you make a a forum post for it. thanks.)

You’re right, although this is about passing along an env var for SG, it’s more of a deadline question

Heya, related to the above topic on the AYON_SG_USERNAME. I can get it to set to the current Windows user with “AYON_SG_USERNAME”: “{USERNAME}” in the Core addon’s environment settings, but is there an easy way to set this to the currently logged in Ayon user or is setting environment variables based on the Ayon context a bit more awkward?

SG Addon: 0.3.2

An issue I have been consistently having is deletions not properly syncing when they are removed from Shotgrid and having that being represented in Ayon. The event is properly picked up by the Leecher:

Leecher Log
2024-04-04 03:02:59 INFO       Processing Shotgrid Event {'type': 'EventLogEntry', 'id': 529636, 'event_type': 'Shotgun_Shot_Retirement', 'attribute_name': None, 'meta': {'entity_type': 'Shot', 'class_name': 'Shot', 'entity_id': 1573, 'id': 1573, 'type': 'entity_retirement', 'retirement_date': '2024-04-04 03:02:52 UTC', 'display_name': '0030'}, 'entity': None, 'user': {'id': 121, 'name': 'Stephen Scollay', 'type': 'HumanUser'}, 'project': {'id': 519, 'name': 'BJ0003_Ayon_SGCreated_Test', 'type': 'Project'}, 'session_uuid': None, 'created_at': datetime.datetime(2024, 4, 4, 3, 2, 52, tzinfo=<shotgun_api3.lib.sgtimezone.LocalTimezone object at 0x7f40fb99f910>)}
2024-04-04 03:02:59 INFO       Leeched Shotgun_Shot_Retirement by Stephen Scollay
2024-04-04 03:02:59 INFO       Event is from Project BJ0003_Ayon_SGCreated_Test (519)
2024-04-04 03:03:00 DEBUG      Found Shotgrid Project {'type': 'Project', 'id': 519, 'code': 'BJ0003'}
2024-04-04 03:03:00 INFO       Dispatched Ayon event  Shotgun_Shot_Retirement

and processed by the processor:

Processor Log
Logged in as user "service_key"
2024-04-04 03:03:05 DEBUG      Succesfully connected to Shotgrid.
2024-04-04 03:03:06 INFO       Project BJ0003_Ayon_SGCreated_Test <BJ0003_Ayon_SGCreated_Test> already exists in AYON.
2024-04-04 03:03:06 INFO       Project BJ0003_Ayon_SGCreated_Test (BJ0003) <519> already exists in Shotgrid.
2024-04-04 03:03:06 DEBUG      Transforming sg_entity '{'type': 'Shot', 'id': 1573, 'code': '0030', 'sg_status_list': 'wtg', 'tags': [], 'project': {'id': 519, 'name': 'BJ0003_Ayon_SGCreated_Test', 'type': 'Project'}, 'sg_sequence': {'id': 338, 'name': 'SGC', 'type': 'Sequence'}, 'shots': [], 'sg_ayon_id': '9c96bdacf22f11ee958300155d700f23', 'sg_ayon_sync_status': None}' to ayon dict.
2024-04-04 03:03:06 DEBUG      SG Entity as Ay dict: {'label': '0030', 'name': '0030', 'shotgridId': 1573, 'shotgridType': 'Shot', 'sg_ayon_id': '9c96bdacf22f11ee958300155d700f23', 'sg_ayon_sync_status': None, 'type': 'Shot'}
2024-04-04 03:03:07 INFO       Deleting AYON entity: <FolderEntity - 9c96bdacf22f11ee958300155d700f23>
2024-04-04 03:03:07 INFO       Event has been processed... setting to finished!

But the entity is not actually removed from Ayon despite what the log says. Does anyone know how to solve this?

I can confirm I’m experiencing the same issue with the develop versions of the addon as well. It’s happening here ayon-shotgrid/services/shotgrid_common/ayon_shotgrid_hub/update_from_shotgrid.py at 370e138a79bd57c4ecd2586ca6f46f7b7e51dc05 · ynput/ayon-shotgrid · GitHub and the problem is that the delete_entity function doesn’t error out or return any log on whether it actually deleted or encountered any issue so it’s kind of hard to tell now as it is what’s going on. @jakub.jezek can you confirm if that function works?

1 Like

Someone needs to update the submit Deadline job code entries (unfortunately there’s a few different places where they do this) so it includes whatever environment variable we choose to use on the Shotgrid addon. For example if you look at this one:
ayon-core/client/ayon_core/modules/deadline/plugins/publish/submit_publish_job.py at f42ee6049006ca803f90f54db613c9a5dc24b132 · ynput/ayon-core · GitHub Only these env vars are being passed to the Deadline job:

    environ_keys = [
        "FTRACK_API_USER",
        "FTRACK_API_KEY",
        "FTRACK_SERVER",
        "AYON_APP_NAME",
        "AYON_USERNAME",
        "OPENPYPE_SG_USER",
        "KITSU_LOGIN",
        "KITSU_PWD"
    ]

We would need to add AYON_SG_USERNAME to the list or make use of AYON_USERNAME in the Shotgrid addon