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

Chore: Set environment variables for farm #1023

Merged
merged 8 commits into from
Nov 26, 2024

Conversation

iLLiCiTiT
Copy link
Member

Changelog Description

Moved some of logic to define farm job environment variables from ayon-deadline to ayon-core.

Additional info

There already is plugin https://github.com/ynput/ayon-deadline/blob/develop/client/ayon_deadline/plugins/publish/global/collect_deadline_job_env_vars.py that is collecting environment variables, but that is not extedable because the constant defined in deadline should be supplied from ayon core, and most of the variables defined in the plugin should be defined by ayon-core, ayon-ftrack, ayon-shotgrid or ayon-applications addon. This is first step to be able to actually do it in the other plugins. Right now they would have to import from ayon-deadline and have dependency to ayon-deadline addon.

This PR also will take effect only with changes in this PR ynput/ayon-deadline#67

Future steps

  • Remove those env variables from ayon-deadline.
  • Use constant FARM_JOB_ENV_DATA_KEY defined in ayon core instead of constant defined in ayon deadline.
  • Move remaining env variables to corresponding repositories (ftrack > ftrack addon, shotgrid > shotgrid addon, applications > applications addon.

Testing notes:

  1. With this PR Chore: Don't override already set env variables ayon-deadline#67 the environment variables should be set by ayon-core.

@iLLiCiTiT iLLiCiTiT self-assigned this Nov 25, 2024
@iLLiCiTiT iLLiCiTiT added the type: enhancement Improvement of existing functionality or minor addition label Nov 25, 2024
@ynbot ynbot added the size/XS label Nov 25, 2024
Copy link
Collaborator

@BigRoy BigRoy left a comment

Choose a reason for hiding this comment

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

Looks good to me - with the exception of the comments as potential follow ups.

"AYON_PROJECT_NAME",
"AYON_FOLDER_PATH",
"AYON_TASK_NAME",
"AYON_WORKDIR",
Copy link
Collaborator

Choose a reason for hiding this comment

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

I know it's technically not related to this PR - but why do we need to pass the workdir? Isn't this workdir path also local to the current machine and not rootless? I have a feeling we should maybe, after this PR investigate this and potentially clean that up?

Copy link
Collaborator

Choose a reason for hiding this comment

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

It may be used here by the way:

  • # Remap workdir if it's set
    workdir = os.getenv("AYON_WORKDIR")
    remapped_workdir = None
    if workdir:
    remapped_workdir = anatomy.roots_obj.path_remapper(
    os.getenv("AYON_WORKDIR")
    )
    if remapped_workdir:
    os.environ["AYON_WORKDIR"] = remapped_workdir
    except Exception as e:
    self.log.error(e, exc_info=True)
    raise Exception("Error") from e

But I guess that should still be set by the "launch context" regardless?

Copy link
Member Author

Choose a reason for hiding this comment

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

I did try to find out where it is used, and I didn't find anything. If you can create issue it would be nice.

Copy link
Member Author

Choose a reason for hiding this comment

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

It may be used here by the way:

Yes, but is it then used for anything?

@iLLiCiTiT iLLiCiTiT merged commit 62e96de into develop Nov 26, 2024
5 checks passed
@iLLiCiTiT iLLiCiTiT deleted the enhancement/farm-env-variables branch November 26, 2024 09:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/XS type: enhancement Improvement of existing functionality or minor addition
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants