-
Notifications
You must be signed in to change notification settings - Fork 37
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
+35
−0
Merged
Changes from 5 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
9cd354e
added constant to define store key for env variables
iLLiCiTiT fae4eed
added new plugin collecting environment variables to context
iLLiCiTiT 8111b4d
Merge branch 'develop' into enhancement/farm-env-variables
iLLiCiTiT 85be6b2
remove unnecessary attribute
iLLiCiTiT fa88c29
Merge branch 'develop' into enhancement/farm-env-variables
iLLiCiTiT cd5f89a
remove OpenPype env key
iLLiCiTiT c7940b4
added comment to workdir env
iLLiCiTiT 4d86202
Merge branch 'develop' into enhancement/farm-env-variables
iLLiCiTiT File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
client/ayon_core/plugins/publish/collect_farm_env_variables.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import os | ||
|
||
import pyblish.api | ||
|
||
from ayon_core.pipeline.publish import FARM_JOB_ENV_DATA_KEY | ||
|
||
|
||
class CollectCoreJobEnvVars(pyblish.api.ContextPlugin): | ||
"""Collect set of environment variables to submit with deadline jobs""" | ||
order = pyblish.api.CollectorOrder - 0.45 | ||
label = "AYON core Farm Environment Variables" | ||
targets = ["local"] | ||
|
||
def process(self, context): | ||
env = context.data.setdefault(FARM_JOB_ENV_DATA_KEY, {}) | ||
for key in [ | ||
# AYON | ||
"AYON_BUNDLE_NAME", | ||
"AYON_DEFAULT_SETTINGS_VARIANT", | ||
"AYON_PROJECT_NAME", | ||
"AYON_FOLDER_PATH", | ||
"AYON_TASK_NAME", | ||
"AYON_WORKDIR", | ||
"AYON_LOG_NO_COLORS", | ||
"AYON_IN_TESTS", | ||
# backwards compatibility | ||
"IS_TEST", | ||
iLLiCiTiT marked this conversation as resolved.
Show resolved
Hide resolved
|
||
]: | ||
value = os.getenv(key) | ||
if value: | ||
self.log.debug(f"Setting job env: {key}: {value}") | ||
env[key] = value | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 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?
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.
It may be used here by the way:
ayon-core/client/ayon_core/plugins/publish/collect_rendered_files.py
Lines 176 to 187 in a08a1af
But I guess that should still be set by the "launch context" regardless?
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 did try to find out where it is used, and I didn't find anything. If you can create issue it would be nice.
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.
Yes, but is it then used for anything?