Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

General: Environment variables groups #2424

Merged
merged 5 commits into from
Dec 20, 2021
Merged

Conversation

iLLiCiTiT
Copy link
Member

@iLLiCiTiT iLLiCiTiT commented Dec 17, 2021

Brief description

Give ability to set different environment variables when are prepared on artist machine and on farm.

Description

Added one more dictionary level to environment variables dictionary which is called environment group. Default group is "standard" but is not used until environment data values use it. This gives ability to not change current settings but just extend their usage.

The environment variable group level does NOT apply on general environment variables. General environments are set in start.py before openpype cli is used.

The new dictionary level can be used before platform specific level. Example:

{
    "ENV_KEY": {
        "farm": {
            "windows": "WINDOWS",
            "linux": "LINUX",
            "darwin": "MACOS"
        }
    }
}

It won't work if the order is swapped. This will NOT work and the key will be skipped:

{
    "ENV_KEY": {
        "windows": {
            "farm": "WINDOWS"
        }
    }
}

It is also NOT possible to combine them at the same level. Only platform specific value will be used:

{
    # The key won't be set at all on Linux and MacOs
    "ENV_KEY": {
        "windows": "WINDOWS",
        "farm": "FARM"
}

New parsing function also keeps empty strings. Not sure if it's ok but there is no way how to "unset" environment variable value right now which should be possible, or?

Changes

  • implemented new function parse_environments which parse environmet variables data for passed context
    • context is defined by environemnt group ("standard" is default) and platform name
  • the function is used when application and tool environments are used and when project specific environments are used
  • command extractenvironment can have specified envgroup value
  • deadline global job specify envgroup value to "farm"

@iLLiCiTiT iLLiCiTiT self-assigned this Dec 17, 2021
@iLLiCiTiT iLLiCiTiT added backend type: enhancement Enhancements to existing functionality labels Dec 17, 2021
Copy link
Member

@kalisp kalisp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It solves customer's use case for not having particular env var returned when called from farm.

@iLLiCiTiT iLLiCiTiT merged commit fdcbd03 into develop Dec 20, 2021
@iLLiCiTiT iLLiCiTiT deleted the feature/OP_2395_env_groups branch January 5, 2022 15:08
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: enhancement Enhancements to existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants