Skip to content

Commit

Permalink
Merge pull request #43 from ynput/feature/41-fill-environment-variabl…
Browse files Browse the repository at this point in the history
…es-for-farm

Fill environment variables for farm jobs
  • Loading branch information
iLLiCiTiT authored Jan 9, 2025
2 parents 0c2cb0b + c478769 commit 1a0a831
Showing 1 changed file with 26 additions and 0 deletions.
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

0 comments on commit 1a0a831

Please sign in to comment.