Load Ayon plugin in deadline when submitting from houdini manually

Hi! Can Ayon be loaded by default for all jobs by the deadline?
I tried to place the GlobalJobPreLoad.py in repo/plugins/ to load Ayon by default, but it didn’t work out

Why do I need it?
We have some otls which are having ayon code inside to get the frame ranges and other data. when we pushed these otls to the deadline, since I’m submitting with our own otls ayon environment was not loading in the deadline.

No - not without knowing more about your specific submitted job.

The GlobalJobPreLoad always runs already, if correctly put in your Deadline repository which the default instructions in the documentation would do.

However, the ‘ingest AYON environments’ workflow only enables itself whenever a AYON_RENDER_JOB=1 environment variable is found - usually specified on the job.

There’s more to it. Just setting that will soon show you that it will then error, because it needs more knowledge about your context, the AYON bundle name, project, folder, task and app. Specifically:

AYON_BUNDLE_NAME
AYON_PROJECT_NAME
AYON_FOLDER_PATH
AYON_TASK_NAME
AYON_APP_NAME

This is because the environment it needs to initialize is dependent on the application you’re launching and what task you’re working in (because tools may be specified per task.)

As, such - as soon as you job passes along AYON_RENDER_JOB=1 along with those context environment variables the environment will be build up for you as needed.

The real question is why you are facing this issue. Because AYON publish submissions add these automatically to the job submissions. It seems like you’re submitting these render jobs in a different way?

2 Likes

Agree with Roy.

Keep in mind there are much data within submitted jobs via AYON.

1 Like

As far as I’m aware the additional metadata is not required for the GlobalJobPreLoad.py to do its thing. However - the AYON_DEFAULT_SETTINGS_VARIANT may indeed be picked up by the process that builds up the environment - because otherwise it’d most likely default always to production and disallow e.g. dev or staging submissions?

That senses, I just saw the logic behind the globalJobPreLoad.py

I guess the only solution is to push with environment variables to the deadline from houdini itself, I tried to make changes to deadline code but just not working for all machines.

I think this mostly solves the problem after adding ayon code to it, but we were trying to take advantage of getting data from ayon web data like frameranges etc.

Can you guys please point to the code where we push the environment variables using ayon to deadline?

This recent PR is a good insight into that - since it moved it: Allow job environment variable to be specified via context or instance by BigRoy · Pull Request #32 · ynput/ayon-deadline · GitHub

Does that help?

1 Like

The solution is below to load the Ayon plugin when the job submission is on deadline:

In the deadline repo submission\Houdini\Main\SubmitHoudiniToDeadlineFunctions.py
Add the below code

                    # AYON Edit: Transfer along AYON attributes to make it an AYON submission
                    envs = {}
                    for key in [
                        # AYON
                        "AYON_BUNDLE_NAME",
                        "AYON_DEFAULT_SETTINGS_VARIANT",
                        "AYON_PROJECT_NAME",
                        "AYON_FOLDER_PATH",
                        "AYON_TASK_NAME",
                        "AYON_APP_NAME",
                        "AYON_WORKDIR",
                        "AYON_APP_NAME",
                        "AYON_LOG_NO_COLORS",
                        "AYON_IN_TESTS",
                        "IS_TEST",  # backwards compatibility
                    ]:
                        value = os.getenv(key)
                        if value:
                            envs[key] = value
                            
                    envs["AYON_RENDER_JOB"] = "1"
                    for index, (key, value) in enumerate(envs.items()):
                        text = f'EnvironmentKeyValue{index}={key}={value}'
                        fileHandle.write(text + "\n")

at the #Createsubmissioninfofile context under all the fileHandle.writes (at 772 lines can be vary later)

This potentially allows us to push the environment variables when submitting the job.

Huge thanks to Champ! @BigRoy

1 Like