Cleaned up how selected RR server is queried

It should be only queried only once in Collector phase, not multiple times.

There is no real possibility to select RR server on instance, eg. artist cannot set that in Publisher, but thats on different PR.
This commit is contained in:
Petr Kalis 2024-02-21 12:09:51 +01:00
parent c1e528e134
commit 528f161472
3 changed files with 5 additions and 42 deletions

View file

@ -108,9 +108,7 @@ class BaseCreateRoyalRenderJob(pyblish.api.InstancePlugin,
context = instance.context
self._rr_root = self._resolve_rr_path(context, instance.data.get(
"rrPathName")) # noqa
self.log.debug(self._rr_root)
self._rr_root = instance.data.get("rrPathName")
if not self._rr_root:
raise KnownPublishError(
("Missing RoyalRender root. "
@ -210,20 +208,6 @@ class BaseCreateRoyalRenderJob(pyblish.api.InstancePlugin,
"""Host specific mapping for RRJob"""
raise NotImplementedError
@staticmethod
def _resolve_rr_path(context, rr_path_name):
# type: (pyblish.api.Context, str) -> str
rr_settings = context.data["project_settings"]["royalrender"]
rr_paths = rr_settings["rr_paths"]
selected_paths = rr_settings["selected_rr_paths"]
rr_servers = {
path_key: rr_paths[path_key]
for path_key in selected_paths
if path_key in rr_paths
}
return rr_servers[rr_path_name][platform.system().lower()]
def expected_files(self, instance, path, start_frame, end_frame):
"""Get expected files.

View file

@ -19,6 +19,9 @@ class CollectRRPathFromInstance(pyblish.api.InstancePlugin):
# type: (pyblish.api.Instance) -> str
"""Get Royal Render pat name from render instance."""
# TODO there are no "rrPaths" on instance, if Publisher should expose
# this (eg. artist could select specific server) it must be added
# to publisher
instance_rr_paths = instance.data.get("rrPaths")
if instance_rr_paths is None:
return "default"

View file

@ -25,16 +25,6 @@ class SubmitJobsToRoyalRender(pyblish.api.ContextPlugin):
self._submission_parameters = []
def process(self, context):
rr_settings = (
context.data
["system_settings"]
["modules"]
["royalrender"]
)
if rr_settings["enabled"] is not True:
self.log.warning("RoyalRender modules is disabled.")
return
# iterate over all instances and try to find RRJobs
jobs = []
@ -51,7 +41,7 @@ class SubmitJobsToRoyalRender(pyblish.api.ContextPlugin):
instance_rr_path = instance.data["rrPathName"]
if jobs:
self._rr_root = self._resolve_rr_path(context, instance_rr_path)
self._rr_root = instance_rr_path
if not self._rr_root:
raise KnownPublishError(
("Missing RoyalRender root. "
@ -100,17 +90,3 @@ class SubmitJobsToRoyalRender(pyblish.api.ContextPlugin):
def get_submission_parameters(self):
return [SubmitterParameter("RequiredMemory", "0")]
@staticmethod
def _resolve_rr_path(context, rr_path_name):
# type: (pyblish.api.Context, str) -> str
rr_settings = context.data["project_settings"]["royalrender"]
rr_paths = rr_settings["rr_paths"]
selected_paths = rr_settings["selected_rr_paths"]
rr_servers = {
path_key: rr_paths[path_key]
for path_key in selected_paths
if path_key in rr_paths
}
return rr_servers[rr_path_name][platform.system().lower()]