generated from ynput/ayon-addon-template
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #43 from ynput/feature/41-fill-environment-variabl…
…es-for-farm Fill environment variables for farm jobs
- Loading branch information
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
client/ayon_applications/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,26 @@ | ||
import os | ||
|
||
import pyblish.api | ||
|
||
try: | ||
from ayon_core.pipeline.publish import FARM_JOB_ENV_DATA_KEY | ||
except ImportError: | ||
# NOTE Can be removed when ayon-core >= 1.0.10 is required in package.py | ||
FARM_JOB_ENV_DATA_KEY = "farmJobEnv" | ||
|
||
|
||
class CollectApplicationsJobEnvVars(pyblish.api.ContextPlugin): | ||
"""Collect set of environment variables for farm jobs""" | ||
order = pyblish.api.CollectorOrder - 0.45 | ||
label = "Collect Applications farm environment variables" | ||
targets = ["local"] | ||
|
||
def process(self, context): | ||
env = context.data.setdefault(FARM_JOB_ENV_DATA_KEY, {}) | ||
for key in [ | ||
"AYON_APP_NAME", | ||
]: | ||
value = os.getenv(key) | ||
if value: | ||
self.log.debug(f"Setting job env: {key}: {value}") | ||
env[key] = value |