DL expected files validation - added 'targets' to 'publish' command for more precise plugin selections

Validator for expected files should run only during publishing on farm, targets=deadline handles that
This commit is contained in:
Petr Kalis 2021-06-03 17:44:29 +02:00
parent 2a65671997
commit 5ca1eb7a4f
2 changed files with 12 additions and 4 deletions

View file

@ -132,7 +132,9 @@ def extractenvironments(output_json_path, project, asset, task, app):
@main.command()
@click.argument("paths", nargs=-1)
@click.option("-d", "--debug", is_flag=True, help="Print debug messages")
def publish(debug, paths):
@click.option("-t", "--targets", help="Targets module", default=None,
multiple=True)
def publish(debug, paths, targets):
"""Start CLI publishing.
Publish collects json from paths provided as an argument.
@ -140,7 +142,7 @@ def publish(debug, paths):
"""
if debug:
os.environ['OPENPYPE_DEBUG'] = '3'
PypeCommands.publish(list(paths))
PypeCommands.publish(list(paths), targets)
@main.command()

View file

@ -43,16 +43,18 @@ class PypeCommands:
standalonepublish.main()
@staticmethod
def publish(paths):
def publish(paths, targets=None):
"""Start headless publishing.
Publish use json from passed paths argument.
Args:
paths (list): Paths to jsons.
targets (string): What module should be targeted
(to choose validator for example)
Raises:
RuntimeError: When there is no pathto process.
RuntimeError: When there is no path to process.
"""
if not any(paths):
raise RuntimeError("No publish paths specified")
@ -79,6 +81,10 @@ class PypeCommands:
pyblish.api.register_target("filesequence")
pyblish.api.register_host("shell")
if targets:
for target in targets:
pyblish.api.register_target(target)
os.environ["OPENPYPE_PUBLISH_DATA"] = os.pathsep.join(paths)
log.info("Running publish ...")