From 528f161472c0ca1e68244b99334b72f777e3dff6 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Wed, 21 Feb 2024 12:09:51 +0100 Subject: [PATCH] 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. --- client/ayon_core/modules/royalrender/lib.py | 18 +------------ .../publish/collect_rr_path_from_instance.py | 3 +++ .../publish/submit_jobs_to_royalrender.py | 26 +------------------ 3 files changed, 5 insertions(+), 42 deletions(-) diff --git a/client/ayon_core/modules/royalrender/lib.py b/client/ayon_core/modules/royalrender/lib.py index 966eb82ab1..73383d482c 100644 --- a/client/ayon_core/modules/royalrender/lib.py +++ b/client/ayon_core/modules/royalrender/lib.py @@ -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. diff --git a/client/ayon_core/modules/royalrender/plugins/publish/collect_rr_path_from_instance.py b/client/ayon_core/modules/royalrender/plugins/publish/collect_rr_path_from_instance.py index f43ed1ca49..d860df4684 100644 --- a/client/ayon_core/modules/royalrender/plugins/publish/collect_rr_path_from_instance.py +++ b/client/ayon_core/modules/royalrender/plugins/publish/collect_rr_path_from_instance.py @@ -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" diff --git a/client/ayon_core/modules/royalrender/plugins/publish/submit_jobs_to_royalrender.py b/client/ayon_core/modules/royalrender/plugins/publish/submit_jobs_to_royalrender.py index 5e25464186..dcec2ac810 100644 --- a/client/ayon_core/modules/royalrender/plugins/publish/submit_jobs_to_royalrender.py +++ b/client/ayon_core/modules/royalrender/plugins/publish/submit_jobs_to_royalrender.py @@ -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()]