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

Nuke: deadline submit limit group filter #1167

Merged
Merged
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
40 changes: 38 additions & 2 deletions pype/plugins/nuke/publish/submit_nuke_deadline.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from avalon.vendor import requests
import re
import pyblish.api

import nuke

class NukeSubmitDeadline(pyblish.api.InstancePlugin):
"""Submit write to Deadline
Expand All @@ -29,6 +29,7 @@ class NukeSubmitDeadline(pyblish.api.InstancePlugin):
deadline_pool_secondary = ""
deadline_group = ""
deadline_department = ""
deadline_limit_groups = {}
env_overrides = {}

def process(self, instance):
Expand Down Expand Up @@ -146,6 +147,10 @@ def payload_submit(self,
if not priority:
priority = self.deadline_priority

# resolve any limit groups
limit_groups = self.get_limit_groups()
self.log.info("Limit groups: `{}`".format(limit_groups))

payload = {
"JobInfo": {
# Top-level group name
Expand Down Expand Up @@ -177,7 +182,10 @@ def payload_submit(self,

# Optional, enable double-click to preview rendered
# frames from Deadline Monitor
"OutputFilename0": output_filename_0.replace("\\", "/")
"OutputFilename0": output_filename_0.replace("\\", "/"),

# limiting groups
"LimitGroups": ",".join(limit_groups)

},
"PluginInfo": {
Expand Down Expand Up @@ -352,3 +360,31 @@ def expected_files(self,
for i in range(self._frame_start, (self._frame_end + 1)):
instance.data["expectedFiles"].append(
os.path.join(dir, (file % i)).replace("\\", "/"))

def get_limit_groups(self):
"""Search for limit group nodes and return group name.

Limit groups will be defined as pairs in Nuke deadline submitter
presents where the key will be name of limit group and value will be
a list of plugin's node class names. Thus, when a plugin uses more
than one node, these will be captured and the triggered process
will add the appropriate limit group to the payload jobinfo attributes.

Returning:
list: captured groups list
"""
captured_groups = []
for lg_name, list_node_class in self.deadline_limit_groups.items():
for node_class in list_node_class:
for node in nuke.allNodes(recurseGroups=True):
# ignore all nodes not member of defined class
if node.Class() not in node_class:
continue
# ignore all disabled nodes
if node["disable"].value():
continue
# add group name if not already added
if lg_name not in captured_groups:
captured_groups.append(lg_name)

return captured_groups