Skip to content

Commit

Permalink
Merge pull request #1031 from ynput/enhancement/better-value-sources-…
Browse files Browse the repository at this point in the history
…for-farm-env

Farm env: Collect correct values for farm
  • Loading branch information
iLLiCiTiT authored Nov 29, 2024
2 parents 2842c90 + 630f7f6 commit 01a5917
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions client/ayon_core/plugins/publish/collect_farm_env_variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import pyblish.api

from ayon_core.lib import get_ayon_username
from ayon_core.pipeline.publish import FARM_JOB_ENV_DATA_KEY


Expand All @@ -15,16 +16,22 @@ def process(self, context):
env = context.data.setdefault(FARM_JOB_ENV_DATA_KEY, {})

# Disable colored logs on farm
env["AYON_LOG_NO_COLORS"] = "1"
for key, value in (
("AYON_LOG_NO_COLORS", "1"),
("AYON_PROJECT_NAME", context.data["projectName"]),
("AYON_FOLDER_PATH", context.data.get("folderPath")),
("AYON_TASK_NAME", context.data.get("task")),
# NOTE we should use 'context.data["user"]' but that has higher
# order.
("AYON_USERNAME", get_ayon_username()),
):
if value:
self.log.debug(f"Setting job env: {key}: {value}")
env[key] = value

for key in [
"AYON_BUNDLE_NAME",
"AYON_DEFAULT_SETTINGS_VARIANT",
"AYON_USERNAME",
"AYON_PROJECT_NAME",
"AYON_FOLDER_PATH",
"AYON_TASK_NAME",
"AYON_LOG_NO_COLORS",
"AYON_IN_TESTS",
# NOTE Not sure why workdir is needed?
"AYON_WORKDIR",
Expand Down

0 comments on commit 01a5917

Please sign in to comment.