From 14fd3fa2daec2d9389ff8cda4bc120e168092a5e Mon Sep 17 00:00:00 2001 From: Ondrej Samohel Date: Mon, 30 Sep 2019 17:07:59 +0200 Subject: [PATCH] bugfixes, some PEP8 changes and final pool support --- pype/plugins/global/publish/submit_publish_job.py | 9 +++------ pype/plugins/maya/create/create_renderglobals.py | 11 +++++++++-- pype/plugins/maya/publish/collect_renderlayers.py | 4 +++- pype/plugins/maya/publish/submit_maya_muster.py | 4 ++-- pype/plugins/maya/publish/validate_rendersettings.py | 3 +-- 5 files changed, 18 insertions(+), 13 deletions(-) diff --git a/pype/plugins/global/publish/submit_publish_job.py b/pype/plugins/global/publish/submit_publish_job.py index 8d352b8872..11d4dc33eb 100644 --- a/pype/plugins/global/publish/submit_publish_job.py +++ b/pype/plugins/global/publish/submit_publish_job.py @@ -1,7 +1,6 @@ import os import json import re -from pprint import pprint import logging from avalon import api, io @@ -147,7 +146,6 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin): "PYPE_ROOT" ] - def _submit_deadline_post_job(self, instance, job): """ Deadline specific code separated from :meth:`process` for sake of @@ -192,7 +190,6 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin): # Transfer the environment from the original job to this dependent # job so they use the same environment - environment = job["Props"].get("Env", {}) i = 0 for index, key in enumerate(environment): @@ -231,12 +228,12 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin): """ # Get a submission job data = instance.data.copy() - render_job = data.pop("deadlineSubmissionJob") + render_job = data.pop("deadlineSubmissionJob", None) submission_type = "deadline" if not render_job: # No deadline job. Try Muster: musterSubmissionJob - render_job = data.pop("musterSubmissionJob") + render_job = data.pop("musterSubmissionJob", None) submission_type = "muster" if not render_job: raise RuntimeError("Can't continue without valid Deadline " @@ -295,7 +292,7 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin): # Optional metadata (for debugging) "metadata": { "instance": data, - "job": job, + "job": render_job, "session": api.Session.copy() } } diff --git a/pype/plugins/maya/create/create_renderglobals.py b/pype/plugins/maya/create/create_renderglobals.py index 1c92ab57b9..c65f1d469f 100644 --- a/pype/plugins/maya/create/create_renderglobals.py +++ b/pype/plugins/maya/create/create_renderglobals.py @@ -31,6 +31,10 @@ class CreateRenderGlobals(avalon.maya.Creator): deadline_url = os.environ.get('DEADLINE_REST_URL', None) muster_url = os.environ.get('MUSTER_REST_URL', None) + if deadline_url and muster_url: + self.log.error("Both Deadline and Muster are enabled. " + "Cannot support both.") + raise RuntimeError("Both Deadline and Muster are enabled") if deadline_url is None: self.log.warning("Deadline REST API url not found.") @@ -49,11 +53,15 @@ class CreateRenderGlobals(avalon.maya.Creator): if muster_url is None: self.log.warning("Muster REST API url not found.") else: + self.log.info(">>> Loading Muster credentials ...") self._load_credentials() + self.log.info(">>> Logging in Muster ...") self._authenticate() + self.log.info(">>> Getting pools ...") pools = self._get_muster_pools() pool_names = [] for pool in pools: + self.log.info(" - pool: {}".format(pool['name'])) pool_names.append(pool['name']) self.data["primaryPool"] = pool_names @@ -137,8 +145,7 @@ class CreateRenderGlobals(avalon.maya.Creator): Get render pools from muster """ params = { - 'authToken': self._token, - '$filter': 'name:ALL' + 'authToken': self._token } api_entry = '/api/pools/list' response = requests.post( diff --git a/pype/plugins/maya/publish/collect_renderlayers.py b/pype/plugins/maya/publish/collect_renderlayers.py index ce80039362..73a4d237ab 100644 --- a/pype/plugins/maya/publish/collect_renderlayers.py +++ b/pype/plugins/maya/publish/collect_renderlayers.py @@ -182,9 +182,11 @@ class CollectMayaRenderlayers(pyblish.api.ContextPlugin): pool_b = None # Check for specific pools + pool_b = [] if "primaryPool" in attributes: pool_a = attributes["primaryPool"] - pool_b = attributes["secondaryPool"] + if "secondaryPool" in attributes: + pool_b = attributes["secondaryPool"] else: # Backwards compatibility diff --git a/pype/plugins/maya/publish/submit_maya_muster.py b/pype/plugins/maya/publish/submit_maya_muster.py index 67d7ff3f96..621af382ca 100644 --- a/pype/plugins/maya/publish/submit_maya_muster.py +++ b/pype/plugins/maya/publish/submit_maya_muster.py @@ -362,7 +362,7 @@ class MayaSubmitMuster(pyblish.api.InstancePlugin): "platform": 0, "job": { "jobName": jobname, - "templateId": self._get_template_id( + "templateId": _get_template_id( instance.data["renderer"]), "chunksInterleave": 2, "chunksPriority": "0", @@ -373,7 +373,7 @@ class MayaSubmitMuster(pyblish.api.InstancePlugin): "dependMode": 0, "emergencyQueue": False, "excludedPools": [""], - "includedPools": renderglobals["primaryPool"], + "includedPools": [renderglobals["Pool"]], "packetSize": 4, "packetType": 1, "priority": 1, diff --git a/pype/plugins/maya/publish/validate_rendersettings.py b/pype/plugins/maya/publish/validate_rendersettings.py index 0d983b9cf1..b949cfdca6 100644 --- a/pype/plugins/maya/publish/validate_rendersettings.py +++ b/pype/plugins/maya/publish/validate_rendersettings.py @@ -13,8 +13,7 @@ class ValidateRenderSettings(pyblish.api.InstancePlugin): * File Name Prefix must be as followed: * vray: maya// - * arnold: maya// - * default: maya// + * default: maya//_ * Frame Padding must be: * default: 4