Account for custom staging directory persistentcy.

This commit is contained in:
Toke Stuart Jepsen 2023-06-25 15:38:26 +01:00
parent 49dc54c647
commit 96d796c4f5
5 changed files with 19 additions and 8 deletions

View file

@ -108,7 +108,8 @@ class ExtractAlembic(publish.Extractor):
}
instance.data["representations"].append(representation)
instance.context.data["cleanupFullPaths"].append(path)
if not instance.data.get("stagingDir_persistent", False):
instance.context.data["cleanupFullPaths"].append(path)
self.log.info("Extracted {} to {}".format(instance, dirname))

View file

@ -80,7 +80,8 @@ class ExtractProxyAlembic(publish.Extractor):
}
instance.data["representations"].append(representation)
instance.context.data["cleanupFullPaths"].append(path)
if not instance.data.get("stagingDir_persistent", False):
instance.context.data["cleanupFullPaths"].append(path)
self.log.info("Extracted {} to {}".format(instance, dirname))
# remove the bounding box

View file

@ -92,7 +92,8 @@ class ExtractThumbnail(publish.Extractor):
"Create temp directory {} for thumbnail".format(dst_staging)
)
# Store new staging to cleanup paths
instance.context.data["cleanupFullPaths"].append(dst_staging)
if not instance.data.get("stagingDir_persistent", False):
instance.context.data["cleanupFullPaths"].append(dst_staging)
filename = "{0}".format(instance.name)
path = os.path.join(dst_staging, filename)

View file

@ -844,7 +844,7 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin,
do_not_add_review = False
if data.get("review"):
families.append("review")
elif data.get("review") == False:
elif data.get("review") is False:
self.log.debug("Instance has review explicitly disabled.")
do_not_add_review = True
@ -872,7 +872,10 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin,
"useSequenceForReview": data.get("useSequenceForReview", True),
# map inputVersions `ObjectId` -> `str` so json supports it
"inputVersions": list(map(str, data.get("inputVersions", []))),
"colorspace": instance.data.get("colorspace")
"colorspace": instance.data.get("colorspace"),
"stagingDir_persistent": instance.data.get(
"stagingDir_persistent", False
)
}
# skip locking version if we are creating v01

View file

@ -124,6 +124,8 @@ class CollectRenderedFiles(pyblish.api.ContextPlugin):
self.log.info(
f"Adding audio to instance: {instance.data['audio']}")
return instance.data.get("stagingDir_persistent", False)
def process(self, context):
self._context = context
@ -160,9 +162,12 @@ class CollectRenderedFiles(pyblish.api.ContextPlugin):
legacy_io.Session.update(session_data)
os.environ.update(session_data)
session_is_set = True
self._process_path(data, anatomy)
context.data["cleanupFullPaths"].append(path)
context.data["cleanupEmptyDirs"].append(os.path.dirname(path))
staging_dir_persistent = self._process_path(data, anatomy)
if not staging_dir_persistent:
context.data["cleanupFullPaths"].append(path)
context.data["cleanupEmptyDirs"].append(
os.path.dirname(path)
)
except Exception as e:
self.log.error(e, exc_info=True)
raise Exception("Error") from e