Color Management- added color management support for simple expected files on Deadline (#5122)

* OP-5864 - added color management support for simple expected files

Previously implemented only for AOVs.

* OP-5864 - fix colorspace query

colorspace might be not on instance.data

* OP-5864 - refactore name to more descriptive one

It is actually instance.data, not proper `instance`.

---------

Co-authored-by: Jakub Ježek <jakubjezek001@gmail.com>
This commit is contained in:
Petr Kalis 2023-06-22 12:02:23 +02:00 committed by GitHub
parent 39d2159ed4
commit 97f3bdf5ec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -21,6 +21,7 @@ from openpype.pipeline import (
from openpype.tests.lib import is_in_tests
from openpype.pipeline.farm.patterning import match_aov_pattern
from openpype.lib import is_running_from_build
from openpype.pipeline import publish
def get_resources(project_name, version, extension=None):
@ -79,7 +80,8 @@ def get_resource_files(resources, frame_range=None):
return list(res_collection)
class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin):
class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin,
publish.ColormanagedPyblishPluginMixin):
"""Process Job submitted on farm.
These jobs are dependent on a deadline or muster job
@ -598,7 +600,8 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin):
self.log.debug("instances:{}".format(instances))
return instances
def _get_representations(self, instance, exp_files, do_not_add_review):
def _get_representations(self, instance_data, exp_files,
do_not_add_review):
"""Create representations for file sequences.
This will return representations of expected files if they are not
@ -606,7 +609,7 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin):
most cases, but if not - we create representation from each of them.
Arguments:
instance (dict): instance data for which we are
instance_data (dict): instance.data for which we are
setting representations
exp_files (list): list of expected files
do_not_add_review (bool): explicitly skip review
@ -628,9 +631,9 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin):
# expected files contains more explicitly and from what
# should be review made.
# - "review" tag is never added when is set to 'False'
if instance["useSequenceForReview"]:
if instance_data["useSequenceForReview"]:
# toggle preview on if multipart is on
if instance.get("multipartExr", False):
if instance_data.get("multipartExr", False):
self.log.debug(
"Adding preview tag because its multipartExr"
)
@ -655,8 +658,8 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin):
" This may cause issues on farm."
).format(staging))
frame_start = int(instance.get("frameStartHandle"))
if instance.get("slate"):
frame_start = int(instance_data.get("frameStartHandle"))
if instance_data.get("slate"):
frame_start -= 1
preview = preview and not do_not_add_review
@ -665,10 +668,10 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin):
"ext": ext,
"files": [os.path.basename(f) for f in list(collection)],
"frameStart": frame_start,
"frameEnd": int(instance.get("frameEndHandle")),
"frameEnd": int(instance_data.get("frameEndHandle")),
# If expectedFile are absolute, we need only filenames
"stagingDir": staging,
"fps": instance.get("fps"),
"fps": instance_data.get("fps"),
"tags": ["review"] if preview else [],
}
@ -676,17 +679,17 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin):
if ext in self.skip_integration_repre_list:
rep["tags"].append("delete")
if instance.get("multipartExr", False):
if instance_data.get("multipartExr", False):
rep["tags"].append("multipartExr")
# support conversion from tiled to scanline
if instance.get("convertToScanline"):
if instance_data.get("convertToScanline"):
self.log.info("Adding scanline conversion.")
rep["tags"].append("toScanline")
representations.append(rep)
self._solve_families(instance, preview)
self._solve_families(instance_data, preview)
# add remainders as representations
for remainder in remainders:
@ -717,13 +720,13 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin):
preview = preview and not do_not_add_review
if preview:
rep.update({
"fps": instance.get("fps"),
"fps": instance_data.get("fps"),
"tags": ["review"]
})
self._solve_families(instance, preview)
self._solve_families(instance_data, preview)
already_there = False
for repre in instance.get("representations", []):
for repre in instance_data.get("representations", []):
# might be added explicitly before by publish_on_farm
already_there = repre.get("files") == rep["files"]
if already_there:
@ -733,6 +736,13 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin):
if not already_there:
representations.append(rep)
for rep in representations:
# inject colorspace data
self.set_representation_colorspace(
rep, self.context,
colorspace=instance_data["colorspace"]
)
return representations
def _solve_families(self, instance, preview=False):
@ -861,7 +871,8 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin):
"jobBatchName": data.get("jobBatchName", ""),
"useSequenceForReview": data.get("useSequenceForReview", True),
# map inputVersions `ObjectId` -> `str` so json supports it
"inputVersions": list(map(str, data.get("inputVersions", [])))
"inputVersions": list(map(str, data.get("inputVersions", []))),
"colorspace": instance.data.get("colorspace")
}
# skip locking version if we are creating v01