Skip to content
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

Use AYON prefix in context environment variables #33

Merged
merged 8 commits into from
Feb 15, 2024

Conversation

iLLiCiTiT
Copy link
Member

Changelog Description

Environment variables which define context now have AYON_ prefix.

Additional info

Renamed used environment variables.

  • AVALON_PROJECT -> AYON_PROJECT_NAME
  • AVALON_ASSET -> AYON_FOLDER_PATH
  • AVALON_TASK -> AYON_TASK_NAME
  • AVALON_APP_NAME -> AYON_APP_NAME
  • AVALON_APP -> AYON_HOST_NAME
  • AVALON_WORKDIR -> AYON_WORKDIR
  • AVALON_LAST_WORKFILE -> AYON_LAST_WORKFILE

Added conversion of the keys to farm publishing (to not break old jobs). But jobs from this PR won't work on older ayon-core.

Session data for launcher actions still support AVALON_* keys too, so actions from other addons should still work.

Testing notes:

Most important test is if this works with old farm jobs.

  1. Create job with older ayon-core.
  2. Suspend the job.
  3. Copy new deadline plugin to deadline repository.
  4. Create job with older ayon-core.
  5. Update ayon-core to this PR.
  6. Resume the job.
  7. It should publish fine.

@MustafaJafar
Copy link
Contributor

MustafaJafar commented Feb 12, 2024

I've submitted a job with old ayon-core + new GlobalJobPreLoad.py and got this error.

Error: Global job preload script 'C:\ProgramData\Thinkbox\Deadline10\workers\Major-Kalawy\plugins\65ca5f4f531db7c24ca6a500\GlobalJobPreLoad.py': ValueError : too many values to unpack (expected 2) (FranticX.Scripting.PythonNetException)
  File "C:\ProgramData\Thinkbox\Deadline10\workers\Major-Kalawy\plugins\65ca5f4f531db7c24ca6a500\GlobalJobPreLoad.py", line 638, in __main__
    inject_ayon_environment(deadlinePlugin)
  File "C:\ProgramData\Thinkbox\Deadline10\workers\Major-Kalawy\plugins\65ca5f4f531db7c24ca6a500\GlobalJobPreLoad.py", line 481, in inject_ayon_environment
    "app": ["AYON_APP_NAME", "AVALON_APP_NAME"],
   at Python.Runtime.PyObject.Invoke(PyObject[] args)
   at Python.Runtime.PyObject.InvokeMethod(String name, PyObject[] args)
   at FranticX.Scripting.PythonNetScriptEngine.CallFunction(String moduleName, String functionName, Object[] args)
   at Deadline.Plugins.PluginWrapper.d()
   at Deadline.Plugins.PluginWrapper.StartJob(String& outMessage, AbortLevel& abortLevel)
.
.
.
.
2024-02-12 20:11:53:  0: PYTHON: *** GlobalJobPreload start ...
2024-02-12 20:11:53:  0: PYTHON: >>> Getting job ...
2024-02-12 20:11:53:  0: PYTHON: >>> Injecting AYON environments ...
2024-02-12 20:11:53:  0: PYTHON: --- Ayon executable: E:\Ynput\ayon-launcher\tools\ayon_console.bat
2024-02-12 20:11:53:  0: PYTHON: >>> Temporary path: C:\Users\MUSTAF~1\AppData\Local\Temp\20240212181153842189_3371bb4c-c9d2-11ee-96ef-f02f74db125e.json
2024-02-12 20:11:53:  0: PYTHON: Traceback (most recent call last):
2024-02-12 20:11:53:  0: PYTHON:   File "C:\ProgramData\Thinkbox\Deadline10\workers\Major-Kalawy\plugins\65ca5f4f531db7c24ca6a500\GlobalJobPreLoad.py", line 481, in inject_ayon_environment
2024-02-12 20:11:53:  0: PYTHON:     "app": ["AYON_APP_NAME", "AVALON_APP_NAME"],
2024-02-12 20:11:53:  0: PYTHON: ValueError: too many values to unpack (expected 2)
2024-02-12 20:11:53:  0: PYTHON: !!! Injection failed.

While we at it.. could you please add a __version__ in the GlobalJobPreLoad.py 😭?
I find hard time to know which is which

@iLLiCiTiT
Copy link
Member Author

iLLiCiTiT commented Feb 12, 2024

I've submitted a job with old ayon-core + new GlobalJobPreLoad.py and got this error.

Hopefully fixed.

While we at it.. could you please add a version in the GlobalJobPreLoad.py 😭?

Will create PR for that.

Copy link
Contributor

@MustafaJafar MustafaJafar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than the typo error.
It works on my side with both old jobs and new jobs.

Co-authored-by: Mustafa Taher <[email protected]>
@iLLiCiTiT iLLiCiTiT merged commit 205f7a8 into develop Feb 15, 2024
@iLLiCiTiT iLLiCiTiT deleted the feature/new-context-env-variables branch February 15, 2024 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants