Skip to content

Commit

Permalink
Merge pull request #95 from ynput/enhancement/91-fill-environment-var…
Browse files Browse the repository at this point in the history
…iables-for-farm

Fill environment variables for farm jobs
  • Loading branch information
iLLiCiTiT authored Jan 6, 2025
2 parents 80403d3 + ece1242 commit af5a36c
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ frontend/.pnp.cjs
frontend/.pnp.loader.mjs

dist/

# JetBrains
.idea/
28 changes: 28 additions & 0 deletions client/ayon_kitsu/plugins/publish/collect_farm_env_variables.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
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 CollectKitsuJobEnvVars(pyblish.api.ContextPlugin):
"""Collect set of environment variables to submit with deadline jobs"""
order = pyblish.api.CollectorOrder - 0.45
label = "Collect Kitsu farm environment variables"
targets = ["local"]

def process(self, context):
env = context.data.setdefault(FARM_JOB_ENV_DATA_KEY, {})
for key in [
"KITSU_SERVER",
"KITSU_LOGIN",
"KITSU_PWD",
]:
value = os.getenv(key)
if value:
self.log.debug(f"Setting job env: {key}: {value}")
env[key] = value

0 comments on commit af5a36c

Please sign in to comment.