Merged in hotfix/farm_rendering (pull request #363)

hotfix for various aspect of farm rendering

Approved-by: Milan Kolar <milan@orbi.tools>
This commit is contained in:
Ondřej Samohel 2019-11-07 16:24:05 +00:00 committed by Milan Kolar
commit f3549af450
11 changed files with 193 additions and 23 deletions

View file

@ -93,7 +93,7 @@ class MusterModule:
'password': password
}
api_entry = '/api/login'
response = requests.post(
response = self._requests_post(
MUSTER_REST_URL + api_entry, params=params)
if response.status_code != 200:
self.log.error(
@ -125,3 +125,17 @@ class MusterModule:
Show dialog to enter credentials
"""
self.widget_login.show()
def _requests_post(self, *args, **kwargs):
""" Wrapper for requests, disabling SSL certificate validation if
DONT_VERIFY_SSL environment variable is found. This is useful when
Deadline or Muster server are running with self-signed certificates
and their certificate is not added to trusted certificates on
client machines.
WARNING: disabling SSL certificate validation is defeating one line
of defense SSL is providing and it is not recommended.
"""
if 'verify' not in kwargs:
kwargs['verify'] = False if os.getenv("PYPE_DONT_VERIFY_SSL", True) else True # noqa
return requests.post(*args, **kwargs)

View file

@ -46,7 +46,7 @@ class ContextPlugin(pyblish.api.ContextPlugin):
class InstancePlugin(pyblish.api.InstancePlugin):
def process(cls, *args, **kwargs):
imprint_attributes(cls)
super(ContextPlugin, cls).process(cls, *args, **kwargs)
super(InstancePlugin, cls).process(cls, *args, **kwargs)
class Extractor(InstancePlugin):

View file

@ -48,7 +48,8 @@ class ExtractJpegEXR(pyblish.api.InstancePlugin):
profile = config_data.get(proj_name, config_data['__default__'])
jpeg_items = []
jpeg_items.append("ffmpeg")
jpeg_items.append(
os.path.join(os.environ.get("FFMPEG_PATH"), "ffmpeg"))
# override file if already exists
jpeg_items.append("-y")
# use same input args like with mov

View file

@ -163,7 +163,10 @@ class ExtractReview(pyblish.api.InstancePlugin):
# output filename
output_args.append(full_output_path)
mov_args = [
"ffmpeg",
os.path.join(
os.environ.get(
"FFMPEG_PATH",
""), "ffmpeg"),
" ".join(input_args),
" ".join(output_args)
]

View file

@ -1,6 +1,10 @@
import pyblish.api
import os
import subprocess
try:
import os.errno as errno
except ImportError:
import errno
class ValidateFfmpegInstallef(pyblish.api.Validator):
@ -18,11 +22,13 @@ class ValidateFfmpegInstallef(pyblish.api.Validator):
[name], stdout=devnull, stderr=devnull
).communicate()
except OSError as e:
if e.errno == os.errno.ENOENT:
if e.errno == errno.ENOENT:
return False
return True
def process(self, instance):
if self.is_tool('ffmpeg') is False:
if self.is_tool(
os.path.join(
os.environ.get("FFMPEG_PATH", ""), "ffmpeg")) is False:
self.log.error("ffmpeg not found in PATH")
raise RuntimeError('ffmpeg not installed.')

View file

@ -160,7 +160,35 @@ class CreateRenderGlobals(avalon.maya.Creator):
api_url = "{}/muster/show_login".format(
os.environ["PYPE_REST_API_URL"])
self.log.debug(api_url)
login_response = requests.post(api_url, timeout=1)
login_response = self._requests_post(api_url, timeout=1)
if login_response.status_code != 200:
self.log.error('Cannot show login form to Muster')
raise Exception('Cannot show login form to Muster')
def _requests_post(self, *args, **kwargs):
""" Wrapper for requests, disabling SSL certificate validation if
DONT_VERIFY_SSL environment variable is found. This is useful when
Deadline or Muster server are running with self-signed certificates
and their certificate is not added to trusted certificates on
client machines.
WARNING: disabling SSL certificate validation is defeating one line
of defense SSL is providing and it is not recommended.
"""
if 'verify' not in kwargs:
kwargs['verify'] = False if os.getenv("PYPE_DONT_VERIFY_SSL", True) else True # noqa
return requests.post(*args, **kwargs)
def _requests_get(self, *args, **kwargs):
""" Wrapper for requests, disabling SSL certificate validation if
DONT_VERIFY_SSL environment variable is found. This is useful when
Deadline or Muster server are running with self-signed certificates
and their certificate is not added to trusted certificates on
client machines.
WARNING: disabling SSL certificate validation is defeating one line
of defense SSL is providing and it is not recommended.
"""
if 'verify' not in kwargs:
kwargs['verify'] = False if os.getenv("PYPE_DONT_VERIFY_SSL", True) else True # noqa
return requests.get(*args, **kwargs)

View file

@ -111,7 +111,11 @@ class MayaSubmitDeadline(pyblish.api.InstancePlugin):
order = pyblish.api.IntegratorOrder + 0.1
hosts = ["maya"]
families = ["renderlayer"]
optional = True
if not os.environ.get("DEADLINE_REST_URL"):
optional = False
active = False
else:
optional = True
def process(self, instance):
@ -319,7 +323,7 @@ class MayaSubmitDeadline(pyblish.api.InstancePlugin):
# E.g. http://192.168.0.1:8082/api/jobs
url = "{}/api/jobs".format(DEADLINE_REST_URL)
response = requests.post(url, json=payload)
response = self._requests_post(url, json=payload)
if not response.ok:
raise Exception(response.text)
@ -340,3 +344,31 @@ class MayaSubmitDeadline(pyblish.api.InstancePlugin):
"%f=%d was rounded off to nearest integer"
% (value, int(value))
)
def _requests_post(self, *args, **kwargs):
""" Wrapper for requests, disabling SSL certificate validation if
DONT_VERIFY_SSL environment variable is found. This is useful when
Deadline or Muster server are running with self-signed certificates
and their certificate is not added to trusted certificates on
client machines.
WARNING: disabling SSL certificate validation is defeating one line
of defense SSL is providing and it is not recommended.
"""
if 'verify' not in kwargs:
kwargs['verify'] = False if os.getenv("PYPE_DONT_VERIFY_SSL", True) else True # noqa
return requests.post(*args, **kwargs)
def _requests_get(self, *args, **kwargs):
""" Wrapper for requests, disabling SSL certificate validation if
DONT_VERIFY_SSL environment variable is found. This is useful when
Deadline or Muster server are running with self-signed certificates
and their certificate is not added to trusted certificates on
client machines.
WARNING: disabling SSL certificate validation is defeating one line
of defense SSL is providing and it is not recommended.
"""
if 'verify' not in kwargs:
kwargs['verify'] = False if os.getenv("PYPE_DONT_VERIFY_SSL", True) else True # noqa
return requests.get(*args, **kwargs)

View file

@ -1,12 +1,16 @@
import os
import json
from maya import cmds
from avalon import api
from avalon.vendor import requests
import pyblish.api
import pype.maya.lib as lib
import getpass
import appdirs
import platform
from maya import cmds
from avalon import api
from avalon.vendor import requests
import pyblish.api
import pype.maya.lib as lib
from pypeapp import config
@ -137,8 +141,12 @@ class MayaSubmitMuster(pyblish.api.InstancePlugin):
order = pyblish.api.IntegratorOrder + 0.1
hosts = ["maya"]
families = ["renderlayer"]
optional = True
icon = "satellite-dish"
if not os.environ.get("MUSTER_REST_URL"):
optional = False
active = False
else:
optional = True
_token = None
@ -175,7 +183,7 @@ class MayaSubmitMuster(pyblish.api.InstancePlugin):
"select": "name"
}
api_entry = '/api/templates/list'
response = requests.post(
response = self._requests_post(
self.MUSTER_REST_URL + api_entry, params=params)
if response.status_code != 200:
self.log.error(
@ -226,7 +234,7 @@ class MayaSubmitMuster(pyblish.api.InstancePlugin):
"name": "submit"
}
api_entry = '/api/queue/actions'
response = requests.post(
response = self._requests_post(
self.MUSTER_REST_URL + api_entry, params=params, json=payload)
if response.status_code != 200:
@ -318,7 +326,10 @@ class MayaSubmitMuster(pyblish.api.InstancePlugin):
muster_python = ("\"C:\\\\Program Files\\\\Virtual Vertex\\\\"
"Muster 9\\\\MPython.exe\"")
else:
muster_python = "/usr/local/muster9/mpython"
# we need to run pype as different user then Muster dispatcher
# service is running (usually root).
muster_python = ("/usr/sbin/runuser -u {}"
" -- /usr/bin/python3".format(getpass.getuser()))
# build the path and argument. We are providing separate --pype
# argument with network path to pype as post job actions are run
@ -550,3 +561,17 @@ class MayaSubmitMuster(pyblish.api.InstancePlugin):
"%f=%d was rounded off to nearest integer"
% (value, int(value))
)
def _requests_post(self, *args, **kwargs):
""" Wrapper for requests, disabling SSL certificate validation if
DONT_VERIFY_SSL environment variable is found. This is useful when
Deadline or Muster server are running with self-signed certificates
and their certificate is not added to trusted certificates on
client machines.
WARNING: disabling SSL certificate validation is defeating one line
of defense SSL is providing and it is not recommended.
"""
if 'verify' not in kwargs:
kwargs['verify'] = False if os.getenv("PYPE_DONT_VERIFY_SSL", True) else True # noqa
return requests.post(*args, **kwargs)

View file

@ -25,6 +25,11 @@ class VraySubmitDeadline(pyblish.api.InstancePlugin):
order = pyblish.api.IntegratorOrder
hosts = ["maya"]
families = ["vrayscene"]
if not os.environ.get("DEADLINE_REST_URL"):
optional = False
active = False
else:
optional = True
def process(self, instance):
@ -109,7 +114,7 @@ class VraySubmitDeadline(pyblish.api.InstancePlugin):
self.log.info("Job Data:\n{}".format(json.dumps(payload)))
response = requests.post(url=deadline_url, json=payload)
response = self._requests_post(url=deadline_url, json=payload)
if not response.ok:
raise RuntimeError(response.text)
@ -188,7 +193,7 @@ class VraySubmitDeadline(pyblish.api.InstancePlugin):
self.log.info(json.dumps(payload_b))
# Post job to deadline
response_b = requests.post(url=deadline_url, json=payload_b)
response_b = self._requests_post(url=deadline_url, json=payload_b)
if not response_b.ok:
raise RuntimeError(response_b.text)
@ -272,3 +277,17 @@ class VraySubmitDeadline(pyblish.api.InstancePlugin):
result = filename_zero.replace("\\", "/")
return result
def _requests_post(self, *args, **kwargs):
""" Wrapper for requests, disabling SSL certificate validation if
DONT_VERIFY_SSL environment variable is found. This is useful when
Deadline or Muster server are running with self-signed certificates
and their certificate is not added to trusted certificates on
client machines.
WARNING: disabling SSL certificate validation is defeating one line
of defense SSL is providing and it is not recommended.
"""
if 'verify' not in kwargs:
kwargs['verify'] = False if os.getenv("PYPE_DONT_VERIFY_SSL", True) else True # noqa
return requests.post(*args, **kwargs)

View file

@ -28,8 +28,22 @@ class ValidateDeadlineConnection(pyblish.api.ContextPlugin):
raise ValueError("Deadline REST API url not found.")
# Check response
response = requests.get(DEADLINE_REST_URL)
response = self._requests_get(DEADLINE_REST_URL)
assert response.ok, "Response must be ok"
assert response.text.startswith("Deadline Web Service "), (
"Web service did not respond with 'Deadline Web Service'"
)
def _requests_get(self, *args, **kwargs):
""" Wrapper for requests, disabling SSL certificate validation if
DONT_VERIFY_SSL environment variable is found. This is useful when
Deadline or Muster server are running with self-signed certificates
and their certificate is not added to trusted certificates on
client machines.
WARNING: disabling SSL certificate validation is defeating one line
of defense SSL is providing and it is not recommended.
"""
if 'verify' not in kwargs:
kwargs['verify'] = False if os.getenv("PYPE_DONT_VERIFY_SSL", True) else True # noqa
return requests.get(*args, **kwargs)

View file

@ -50,7 +50,7 @@ class ValidateMusterConnection(pyblish.api.ContextPlugin):
'authToken': self._token
}
api_entry = '/api/pools/list'
response = requests.get(
response = self._requests_get(
MUSTER_REST_URL + api_entry, params=params)
assert response.status_code == 200, "invalid response from server"
assert response.json()['ResponseData'], "invalid data in response"
@ -87,7 +87,35 @@ class ValidateMusterConnection(pyblish.api.ContextPlugin):
api_url = "{}/muster/show_login".format(
os.environ["PYPE_REST_API_URL"])
cls.log.debug(api_url)
response = requests.post(api_url, timeout=1)
response = cls._requests_post(api_url, timeout=1)
if response.status_code != 200:
cls.log.error('Cannot show login form to Muster')
raise Exception('Cannot show login form to Muster')
def _requests_post(self, *args, **kwargs):
""" Wrapper for requests, disabling SSL certificate validation if
DONT_VERIFY_SSL environment variable is found. This is useful when
Deadline or Muster server are running with self-signed certificates
and their certificate is not added to trusted certificates on
client machines.
WARNING: disabling SSL certificate validation is defeating one line
of defense SSL is providing and it is not recommended.
"""
if 'verify' not in kwargs:
kwargs['verify'] = False if os.getenv("PYPE_DONT_VERIFY_SSL", True) else True # noqa
return requests.post(*args, **kwargs)
def _requests_get(self, *args, **kwargs):
""" Wrapper for requests, disabling SSL certificate validation if
DONT_VERIFY_SSL environment variable is found. This is useful when
Deadline or Muster server are running with self-signed certificates
and their certificate is not added to trusted certificates on
client machines.
WARNING: disabling SSL certificate validation is defeating one line
of defense SSL is providing and it is not recommended.
"""
if 'verify' not in kwargs:
kwargs['verify'] = False if os.getenv("PYPE_DONT_VERIFY_SSL", True) else True # noqa
return requests.get(*args, **kwargs)