Extract iter_expected_files

This commit is contained in:
Petr Kalis 2023-05-03 18:35:22 +02:00
parent 806b9250c8
commit ddab9240a1
4 changed files with 20 additions and 25 deletions

View file

@ -11,6 +11,7 @@ from openpype.pipeline.publish.lib import get_published_workfile_instance
from openpype.pipeline.publish import KnownPublishError
from openpype.modules.royalrender.api import Api as rrApi
from openpype.modules.royalrender.rr_job import RRJob, CustomAttribute
from openpype.pipeline.farm.tools import iter_expected_files
class CreateMayaRoyalRenderJob(InstancePlugin):
@ -43,7 +44,7 @@ class CreateMayaRoyalRenderJob(InstancePlugin):
return "linux"
expected_files = self._instance.data["expectedFiles"]
first_file = next(self._iter_expected_files(expected_files))
first_file = next(iter_expected_files(expected_files))
output_dir = os.path.dirname(first_file)
self._instance.data["outputDir"] = output_dir
workspace = self._instance.context.data["workspaceDir"]
@ -125,16 +126,6 @@ class CreateMayaRoyalRenderJob(InstancePlugin):
self._instance.data["rrJobs"] += self.get_job()
@staticmethod
def _iter_expected_files(exp):
if isinstance(exp[0], dict):
for _aov, files in exp[0].items():
for file in files:
yield file
else:
for file in exp:
yield file
@staticmethod
def _resolve_rr_path(context, rr_path_name):
# type: (Context, str) -> str

View file

@ -19,9 +19,11 @@ from openpype.lib import (
BoolDef,
NumberDef
)
from openpype.pipeline import OpenPypePyblishPluginMixin
from openpype.pipeline.farm.tools import iter_expected_files
class CreateNukeRoyalRenderJob(InstancePlugin):
class CreateNukeRoyalRenderJob(InstancePlugin, OpenPypePyblishPluginMixin):
label = "Create Nuke Render job in RR"
order = IntegratorOrder + 0.1
hosts = ["nuke"]
@ -208,7 +210,8 @@ class CreateNukeRoyalRenderJob(InstancePlugin):
# this will append expected files to instance as needed.
expected_files = self.expected_files(
render_path, start_frame, end_frame)
first_file = next(self._iter_expected_files(expected_files))
self._instance.data["expectedFiles"].extend(expected_files)
first_file = next(iter_expected_files(expected_files))
job = RRJob(
Software="Nuke",