Skip to content
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

Fill environment variables for farm jobs #95

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading