mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-27 14:22:37 +01:00
move the pool settings into the pool collectors
This commit is contained in:
parent
fb6bc696f8
commit
2af4c94e2c
3 changed files with 51 additions and 26 deletions
|
|
@ -3,9 +3,12 @@
|
|||
|
||||
"""
|
||||
import pyblish.api
|
||||
from openpype.lib import TextDef
|
||||
from openpype.pipeline.publish import OpenPypePyblishPluginMixin
|
||||
|
||||
|
||||
class CollectDeadlinePools(pyblish.api.InstancePlugin):
|
||||
class CollectDeadlinePools(pyblish.api.InstancePlugin,
|
||||
OpenPypePyblishPluginMixin):
|
||||
"""Collect pools from instance if present, from Setting otherwise."""
|
||||
|
||||
order = pyblish.api.CollectorOrder + 0.420
|
||||
|
|
@ -19,9 +22,46 @@ class CollectDeadlinePools(pyblish.api.InstancePlugin):
|
|||
primary_pool = None
|
||||
secondary_pool = None
|
||||
|
||||
@classmethod
|
||||
def apply_settings(cls, project_settings, system_settings):
|
||||
# deadline.publish.CollectDeadlinePools
|
||||
settings = project_settings["deadline"]["publish"]["CollectDeadlinePools"] # noqa
|
||||
cls.primary_pool = settings.get("primary_pool", None)
|
||||
cls.secondary_pool = settings.get("secondary_pool", None)
|
||||
for family in cls.families:
|
||||
if family == "maxrender":
|
||||
max_setting = project_settings["deadline"]["publish"]["MaxSubmitDeadline"] # noqa
|
||||
cls.primary_pool = max_setting.get("deadline_pool", None)
|
||||
cls.secondary_pool = max_setting.get("deadline_pool_secondary", None)
|
||||
|
||||
def process(self, instance):
|
||||
|
||||
attr_values = self.get_attr_values_from_data(instance.data)
|
||||
if not instance.data.get("primaryPool"):
|
||||
instance.data["primaryPool"] = self.primary_pool or "none"
|
||||
instance.data["primaryPool"] = (
|
||||
attr_values.get("primaryPool") or self.primary_pool or "none"
|
||||
)
|
||||
|
||||
if not instance.data.get("secondaryPool"):
|
||||
instance.data["secondaryPool"] = self.secondary_pool or "none"
|
||||
instance.data["secondaryPool"] = (
|
||||
attr_values.get("secondaryPool") or self.secondary_pool or "none" # noqa
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def get_attribute_defs(cls):
|
||||
# TODO: Preferably this would be an enum for the user
|
||||
# but the Deadline server URL can be dynamic and
|
||||
# can be set per render instance. Since get_attribute_defs
|
||||
# can't be dynamic unfortunately EnumDef isn't possible (yet?)
|
||||
# pool_names = self.deadline_module.get_deadline_pools(deadline_url,
|
||||
# self.log)
|
||||
# secondary_pool_names = ["-"] + pool_names
|
||||
|
||||
return [
|
||||
TextDef("primaryPool",
|
||||
label="Primary Pool",
|
||||
default=cls.primary_pool),
|
||||
TextDef("secondaryPool",
|
||||
label="Secondary Pool",
|
||||
default=cls.secondary_pool)
|
||||
]
|
||||
|
|
|
|||
|
|
@ -61,10 +61,6 @@ class MaxSubmitDeadline(abstract_submit_deadline.AbstractSubmitDeadline,
|
|||
cls.priority)
|
||||
cls.chunkSize = settings.get("chunk_size", cls.chunkSize)
|
||||
cls.group = settings.get("group", cls.group)
|
||||
cls.deadline_pool = settings.get("deadline_pool",
|
||||
cls.deadline_pool)
|
||||
cls.deadline_pool_secondary = settings.get("deadline_pool_secondary",
|
||||
cls.deadline_pool_secondary)
|
||||
|
||||
def get_job_info(self):
|
||||
job_info = DeadlineJobInfo(Plugin="3dsmax")
|
||||
|
|
@ -95,17 +91,10 @@ class MaxSubmitDeadline(abstract_submit_deadline.AbstractSubmitDeadline,
|
|||
)
|
||||
job_info.Frames = frames
|
||||
|
||||
attr_values = self.get_attr_values_from_data(instance.data)
|
||||
job_info.Pool = instance.data.get("primaryPool")
|
||||
job_info.SecondaryPool = instance.data.get("secondaryPool")
|
||||
|
||||
if attr_values.get("deadline_pool"):
|
||||
job_info.Pool = attr_values.get("deadline_pool")
|
||||
else:
|
||||
job_info.Pool = instance.data.get("primaryPool")
|
||||
if attr_values.get("deadline_pool_secondary"):
|
||||
job_info.SecondaryPool = attr_values.get("deadline_pool_secondary")
|
||||
else:
|
||||
job_info.SecondaryPool = instance.data.get("secondaryPool",
|
||||
self.deadline_pool_secondary) # noqa
|
||||
attr_values = self.get_attr_values_from_data(instance.data)
|
||||
|
||||
job_info.ChunkSize = attr_values.get("chunkSize", 1)
|
||||
job_info.Comment = context.data.get("comment")
|
||||
|
|
@ -275,14 +264,6 @@ class MaxSubmitDeadline(abstract_submit_deadline.AbstractSubmitDeadline,
|
|||
TextDef("group",
|
||||
default=cls.group,
|
||||
label="Group Name"),
|
||||
|
||||
TextDef("deadline_pool",
|
||||
default=cls.deadline_pool,
|
||||
label="Deadline Pool"),
|
||||
|
||||
TextDef("deadline_pool_secondary",
|
||||
default=cls.deadline_pool_secondary,
|
||||
label="Deadline Pool Secondary")
|
||||
])
|
||||
|
||||
return defs
|
||||
|
|
|
|||
|
|
@ -17,7 +17,11 @@ class ValidateDeadlinePools(OptionalPyblishPluginMixin,
|
|||
|
||||
label = "Validate Deadline Pools"
|
||||
order = pyblish.api.ValidatorOrder
|
||||
families = ["rendering", "render.farm", "renderFarm", "renderlayer"]
|
||||
families = ["rendering",
|
||||
"render.farm",
|
||||
"renderFarm",
|
||||
"renderlayer",
|
||||
"maxrender"]
|
||||
optional = True
|
||||
|
||||
def process(self, instance):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue