From 6b513027ab83727a9d8b624f2668cb77a45ef7cb Mon Sep 17 00:00:00 2001 From: antirotor Date: Tue, 20 Nov 2018 17:21:18 +0100 Subject: [PATCH 1/2] first deadline tweaks + small fix in yeti validate pluging --- pype/plugins/maya/create/create_renderglobals.py | 8 ++++++-- pype/plugins/maya/publish/submit_deadline.py | 15 ++++++++++----- .../validate_yeti_renderscript_callbacks.py | 4 ++++ 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/pype/plugins/maya/create/create_renderglobals.py b/pype/plugins/maya/create/create_renderglobals.py index ca086f1f47..74751fd1b2 100644 --- a/pype/plugins/maya/create/create_renderglobals.py +++ b/pype/plugins/maya/create/create_renderglobals.py @@ -20,8 +20,12 @@ class CreateRenderGlobals(avalon.maya.Creator): self.data["id"] = "avalon.renderglobals" # get pools - AVALON_DEADLINE = api.Session["AVALON_DEADLINE"] - argument = "{}/api/pools?NamesOnly=true".format(AVALON_DEADLINE) + try: + deadline_url = os.environ["DEADLINE_REST_URL"] + except KeyError: + self.log.error("Deadline REST API url not found.") + + argument = "{}/api/pools?NamesOnly=true".format(deadline_url) response = requests.get(argument) if not response.ok: self.log.warning("No pools retrieved") diff --git a/pype/plugins/maya/publish/submit_deadline.py b/pype/plugins/maya/publish/submit_deadline.py index 4dabf4837e..ea13cb2b69 100644 --- a/pype/plugins/maya/publish/submit_deadline.py +++ b/pype/plugins/maya/publish/submit_deadline.py @@ -92,7 +92,7 @@ class MayaSubmitDeadline(pyblish.api.InstancePlugin): """Submit available render layers to Deadline Renders are submitted to a Deadline Web Service as - supplied via the environment variable AVALON_DEADLINE + supplied via the environment variable DEADLINE_REST_URL """ @@ -103,9 +103,14 @@ class MayaSubmitDeadline(pyblish.api.InstancePlugin): def process(self, instance): - AVALON_DEADLINE = api.Session.get("AVALON_DEADLINE", - "http://localhost:8082") - assert AVALON_DEADLINE, "Requires AVALON_DEADLINE" + try: + deadline_url = os.environ["DEADLINE_REST_URL"] + except KeyError: + self.log.error("Deadline REST API url not found.") + + # AVALON_DEADLINE = api.Session.get("AVALON_DEADLINE", + # "http://localhost:8082") + # assert AVALON_DEADLINE, "Requires AVALON_DEADLINE" context = instance.context workspace = context.data["workspaceDir"] @@ -240,7 +245,7 @@ class MayaSubmitDeadline(pyblish.api.InstancePlugin): self.log.info(json.dumps(payload, indent=4, sort_keys=True)) # E.g. http://192.168.0.1:8082/api/jobs - url = "{}/api/jobs".format(AVALON_DEADLINE) + url = "{}/api/jobs".format(deadline_url) response = requests.post(url, json=payload) if not response.ok: raise Exception(response.text) diff --git a/pype/plugins/maya/publish/validate_yeti_renderscript_callbacks.py b/pype/plugins/maya/publish/validate_yeti_renderscript_callbacks.py index 1bb27c46e9..ba9b714f11 100644 --- a/pype/plugins/maya/publish/validate_yeti_renderscript_callbacks.py +++ b/pype/plugins/maya/publish/validate_yeti_renderscript_callbacks.py @@ -59,6 +59,10 @@ class ValidateYetiRenderScriptCallbacks(pyblish.api.InstancePlugin): pre_render_callback = cmds.getAttr("defaultRenderGlobals.preMel") post_render_callback = cmds.getAttr("defaultRenderGlobals.postMel") + if (pre_render_callback is None) or (post_render_callback is None): + # no callbacks returned + return False + pre_callbacks = pre_render_callback.split(";") post_callbacks = post_render_callback.split(";") From 60a4c68fa52f0baab1e62c4526762cdf2e97cb85 Mon Sep 17 00:00:00 2001 From: Milan Kolar Date: Mon, 26 Nov 2018 15:41:57 +0100 Subject: [PATCH 2/2] adding changed deadline variable to all plugins --- .../plugins/global/publish/submit_publish_job.py | 13 +++++++++---- .../maya/publish/validate_deadline_connection.py | 16 +++++++++++----- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/pype/plugins/global/publish/submit_publish_job.py b/pype/plugins/global/publish/submit_publish_job.py index ad14f91462..1933713577 100644 --- a/pype/plugins/global/publish/submit_publish_job.py +++ b/pype/plugins/global/publish/submit_publish_job.py @@ -132,9 +132,14 @@ class SubmitDependentImageSequenceJobDeadline(pyblish.api.InstancePlugin): def process(self, instance): - AVALON_DEADLINE = api.Session.get("AVALON_DEADLINE", - "http://localhost:8082") - assert AVALON_DEADLINE, "Requires AVALON_DEADLINE" + # AVALON_DEADLINE = api.Session.get("AVALON_DEADLINE", + # "http://localhost:8082") + # assert AVALON_DEADLINE, "Requires AVALON_DEADLINE" + + try: + deadline_url = os.environ["DEADLINE_REST_URL"] + except KeyError: + self.log.error("Deadline REST API url not found.") # Get a submission job job = instance.data.get("deadlineSubmissionJob") @@ -305,7 +310,7 @@ class SubmitDependentImageSequenceJobDeadline(pyblish.api.InstancePlugin): self.log.info("Submitting..") self.log.info(json.dumps(payload, indent=4, sort_keys=True)) - url = "{}/api/jobs".format(AVALON_DEADLINE) + url = "{}/api/jobs".format(deadline_url) response = requests.post(url, json=payload) if not response.ok: raise Exception(response.text) diff --git a/pype/plugins/maya/publish/validate_deadline_connection.py b/pype/plugins/maya/publish/validate_deadline_connection.py index 53399bfb33..d0f6e9e54d 100644 --- a/pype/plugins/maya/publish/validate_deadline_connection.py +++ b/pype/plugins/maya/publish/validate_deadline_connection.py @@ -1,4 +1,5 @@ import pyblish.api +import os import avalon.api as api from avalon.vendor import requests @@ -14,14 +15,19 @@ class ValidateDeadlineConnection(pyblish.api.ContextPlugin): def process(self, instance): - AVALON_DEADLINE = api.Session.get("AVALON_DEADLINE", - "http://localhost:8082") + # AVALON_DEADLINE = api.Session.get("AVALON_DEADLINE", + # "http://localhost:8082") + # + # assert AVALON_DEADLINE is not None, "Requires AVALON_DEADLINE" - assert AVALON_DEADLINE is not None, "Requires AVALON_DEADLINE" + try: + deadline_url = os.environ["DEADLINE_REST_URL"] + except KeyError: + self.log.error("Deadline REST API url not found.") # Check response - response = requests.get(AVALON_DEADLINE) + response = requests.get(deadline_url) assert response.ok, "Response must be ok" assert response.text.startswith("Deadline Web Service "), ( "Web service did not respond with 'Deadline Web Service'" - ) \ No newline at end of file + )