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

Deadline: Nuke submission additional attributes #1756

Merged
merged 4 commits into from
Jul 1, 2021
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
25 changes: 17 additions & 8 deletions openpype/modules/deadline/plugins/publish/submit_nuke_deadline.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ class NukeSubmitDeadline(pyblish.api.InstancePlugin):
department = ""
limit_groups = {}
use_gpu = False
env_allowed_keys = []
env_search_replace_values = {}

def process(self, instance):
instance.data["toBeRenderedOn"] = "deadline"
Expand Down Expand Up @@ -242,19 +244,19 @@ def payload_submit(self,
"PYBLISHPLUGINPATH",
"NUKE_PATH",
"TOOL_ENV",
"OPENPYPE_DEV",
"FOUNDRY_LICENSE"
]
# add allowed keys from preset if any
if self.env_allowed_keys:
keys += self.env_allowed_keys

environment = dict({key: os.environ[key] for key in keys
if key in os.environ}, **api.Session)
# self.log.debug("enviro: {}".format(pprint(environment)))
for path in os.environ:
if path.lower().startswith('pype_'):
environment[path] = os.environ[path]
if path.lower().startswith('nuke_'):
environment[path] = os.environ[path]
if 'license' in path.lower():
environment[path] = os.environ[path]

for _path in os.environ:
if _path.lower().startswith('openpype_'):
environment[_path] = os.environ[_path]

clean_environment = {}
for key, value in environment.items():
Expand Down Expand Up @@ -285,6 +287,13 @@ def payload_submit(self,
environment = clean_environment
# to recognize job from PYPE for turning Event On/Off
environment["OPENPYPE_RENDER_JOB"] = "1"

# finally search replace in values of any key
if self.env_search_replace_values:
for key, value in environment.items():
for _k, _v in self.env_search_replace_values.items():
environment[key] = value.replace(_k, _v)

payload["JobInfo"].update({
"EnvironmentKeyValue%d" % index: "{key}={value}".format(
key=key,
Expand Down
2 changes: 2 additions & 0 deletions openpype/settings/defaults/project_settings/deadline.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
"group": "",
"department": "",
"use_gpu": true,
"env_allowed_keys": [],
"env_search_replace_values": {},
"limit_groups": {}
},
"HarmonySubmitDeadline": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,20 @@
"key": "use_gpu",
"label": "Use GPU"
},
{
"type": "list",
"key": "env_allowed_keys",
"object_type": "text",
"label": "Allowed environment keys"
},
{
"type": "dict-modifiable",
"key": "env_search_replace_values",
"label": "Search & replace in environment values",
"object_type": {
"type": "text"
}
},
{
"type": "dict-modifiable",
"key": "limit_groups",
Expand Down