From b2bb899815e07408403dbf392daf6f16e2b61051 Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Fri, 3 Jan 2025 16:49:34 +0100 Subject: [PATCH 1/2] added plugin to collect farm environment variables --- .../publish/collect_farm_env_variables.py | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 client/ayon_applications/plugins/publish/collect_farm_env_variables.py diff --git a/client/ayon_applications/plugins/publish/collect_farm_env_variables.py b/client/ayon_applications/plugins/publish/collect_farm_env_variables.py new file mode 100644 index 0000000000..b7761c55dd --- /dev/null +++ b/client/ayon_applications/plugins/publish/collect_farm_env_variables.py @@ -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 to submit with deadline 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 From 4f813a9cf92a8b58a42137e7ff9d76ce6b7fc251 Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Thu, 9 Jan 2025 15:33:20 +0100 Subject: [PATCH 2/2] change docstring --- .../plugins/publish/collect_farm_env_variables.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/ayon_applications/plugins/publish/collect_farm_env_variables.py b/client/ayon_applications/plugins/publish/collect_farm_env_variables.py index b7761c55dd..d3f7cd2675 100644 --- a/client/ayon_applications/plugins/publish/collect_farm_env_variables.py +++ b/client/ayon_applications/plugins/publish/collect_farm_env_variables.py @@ -10,7 +10,7 @@ class CollectApplicationsJobEnvVars(pyblish.api.ContextPlugin): - """Collect set of environment variables to submit with deadline jobs""" + """Collect set of environment variables for farm jobs""" order = pyblish.api.CollectorOrder - 0.45 label = "Collect Applications farm environment variables" targets = ["local"]