Skip to content

Commit

Permalink
added collector to collect farm env variables
Browse files Browse the repository at this point in the history
  • Loading branch information
iLLiCiTiT committed Dec 9, 2024
1 parent e914711 commit 3323c29
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions client/ayon_ftrack/plugins/publish/collect_farm_env_variables.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
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 CollectFtrackJobEnvVars(pyblish.api.ContextPlugin):
"""Collect set of environment variables to submit with deadline jobs"""
order = pyblish.api.CollectorOrder - 0.45
label = "Collect ftrack farm environment variables"
targets = ["local"]

def process(self, context):
env = context.data.setdefault(FARM_JOB_ENV_DATA_KEY, {})

# Disable colored logs on farm
for key in [
"FTRACK_SERVER",
"FTRACK_API_USER",
"FTRACK_API_KEY",
]:
value = os.getenv(key)
if value:
self.log.debug(f"Setting job env: {key}: {value}")
env[key] = value

0 comments on commit 3323c29

Please sign in to comment.