OP-2787 - added collector for remote publishable instances

Filters instances from a workfile and marks only these that should be published on a farm.
This commit is contained in:
Petr Kalis 2022-05-20 19:07:21 +02:00
parent 62ac633da9
commit bf75d18a7b

View file

@ -0,0 +1,39 @@
# -*- coding: utf-8 -*-
"""Collect instances that should be processed and published on DL.
"""
import os
import pyblish.api
class CollectDeadlinePublishableInstances(pyblish.api.InstancePlugin):
"""Collect instances that should be processed and published on DL.
Some long running publishes (not just renders) could be offloaded to DL,
this plugin compares theirs name against env variable, marks only
publishable by farm.
Triggered only when running only in headless mode, eg on a farm.
"""
order = pyblish.api.CollectorOrder + 0.499
label = "Collect Deadline Publishable Instance"
targets = ["remote"]
def process(self, instance):
self.log.debug("CollectDeadlinePublishableInstances")
publish_inst = os.environ.get("OPENPYPE_PUBLISH_SUBSET", '')
assert (publish_inst,
"OPENPYPE_PUBLISH_SUBSET env var required for "
"remote publishing")
subset_name = instance.data["subset"]
if subset_name == publish_inst:
self.log.debug("Publish {}".format(subset_name))
instance.data["publish"] = True
instance.data["farm"] = False
instance.data["families"].remove("deadline")
else:
self.log.debug("Skipping {}".format(subset_name))
instance.data["publish"] = False