Skip to content

collect_farm_env_variables

CollectShotgridJobEnvVars

Bases: ContextPlugin

Collect set of environment variables to submit with deadline jobs

Source code in client/ayon_shotgrid/plugins/publish/collect_farm_env_variables.py
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
class CollectShotgridJobEnvVars(pyblish.api.ContextPlugin):
    """Collect set of environment variables to submit with deadline jobs"""
    order = pyblish.api.CollectorOrder - 0.45
    label = "Collect Shotgrid farm environment variables"
    targets = ["local"]

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