mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
Merge pull request #2616 from pypeclub/feature/OP-2539_Add-openpype-mongo-environments-to-deadline
Deadline: Be able to pass Mongo url to job
This commit is contained in:
commit
a1d84a5a4f
13 changed files with 61 additions and 8 deletions
|
|
@ -118,6 +118,7 @@ class CollectAERender(abstract_collect_render.AbstractCollectRender):
|
|||
instance.anatomyData = context.data["anatomyData"]
|
||||
|
||||
instance.outputDir = self._get_output_dir(instance)
|
||||
instance.context = context
|
||||
|
||||
settings = get_project_settings(os.getenv("AVALON_PROJECT"))
|
||||
reviewable_subset_filter = \
|
||||
|
|
@ -142,7 +143,6 @@ class CollectAERender(abstract_collect_render.AbstractCollectRender):
|
|||
break
|
||||
|
||||
self.log.info("New instance:: {}".format(instance))
|
||||
|
||||
instances.append(instance)
|
||||
|
||||
return instances
|
||||
|
|
|
|||
|
|
@ -176,6 +176,7 @@ class CollectFarmRender(openpype.lib.abstract_collect_render.
|
|||
ignoreFrameHandleCheck=True
|
||||
|
||||
)
|
||||
render_instance.context = context
|
||||
self.log.debug(render_instance)
|
||||
instances.append(render_instance)
|
||||
|
||||
|
|
|
|||
|
|
@ -76,6 +76,7 @@ class RenderInstance(object):
|
|||
deadlineSubmissionJob = attr.ib(default=None)
|
||||
anatomyData = attr.ib(default=None)
|
||||
outputDir = attr.ib(default=None)
|
||||
context = attr.ib(default=None)
|
||||
|
||||
@frameStart.validator
|
||||
def check_frame_start(self, _, value):
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ class CollectDefaultDeadlineServer(pyblish.api.ContextPlugin):
|
|||
order = pyblish.api.CollectorOrder + 0.01
|
||||
label = "Default Deadline Webservice"
|
||||
|
||||
pass_mongo_url = False
|
||||
|
||||
def process(self, context):
|
||||
try:
|
||||
deadline_module = context.data.get("openPypeModules")["deadline"]
|
||||
|
|
@ -19,3 +21,5 @@ class CollectDefaultDeadlineServer(pyblish.api.ContextPlugin):
|
|||
# get default deadline webservice url from deadline module
|
||||
self.log.debug(deadline_module.deadline_urls)
|
||||
context.data["defaultDeadline"] = deadline_module.deadline_urls["default"] # noqa: E501
|
||||
|
||||
context.data["deadlinePassMongoUrl"] = self.pass_mongo_url
|
||||
|
|
|
|||
|
|
@ -67,6 +67,9 @@ class AfterEffectsSubmitDeadline(abstract_submit_deadline.AbstractSubmitDeadline
|
|||
"OPENPYPE_DEV",
|
||||
"OPENPYPE_LOG_NO_COLORS"
|
||||
]
|
||||
# Add mongo url if it's enabled
|
||||
if self._instance.context.data.get("deadlinePassMongoUrl"):
|
||||
keys.append("OPENPYPE_MONGO")
|
||||
|
||||
environment = dict({key: os.environ[key] for key in keys
|
||||
if key in os.environ}, **api.Session)
|
||||
|
|
|
|||
|
|
@ -276,6 +276,9 @@ class HarmonySubmitDeadline(
|
|||
"OPENPYPE_DEV",
|
||||
"OPENPYPE_LOG_NO_COLORS"
|
||||
]
|
||||
# Add mongo url if it's enabled
|
||||
if self._instance.context.data.get("deadlinePassMongoUrl"):
|
||||
keys.append("OPENPYPE_MONGO")
|
||||
|
||||
environment = dict({key: os.environ[key] for key in keys
|
||||
if key in os.environ}, **api.Session)
|
||||
|
|
|
|||
|
|
@ -105,15 +105,21 @@ class HoudiniSubmitPublishDeadline(pyblish.api.ContextPlugin):
|
|||
# Clarify job name per submission (include instance name)
|
||||
payload["JobInfo"]["Name"] = job_name + " - %s" % instance
|
||||
self.submit_job(
|
||||
payload, instances=[instance], deadline=AVALON_DEADLINE
|
||||
context,
|
||||
payload,
|
||||
instances=[instance],
|
||||
deadline=AVALON_DEADLINE
|
||||
)
|
||||
else:
|
||||
# Submit a single job
|
||||
self.submit_job(
|
||||
payload, instances=instance_names, deadline=AVALON_DEADLINE
|
||||
context,
|
||||
payload,
|
||||
instances=instance_names,
|
||||
deadline=AVALON_DEADLINE
|
||||
)
|
||||
|
||||
def submit_job(self, payload, instances, deadline):
|
||||
def submit_job(self, context, payload, instances, deadline):
|
||||
|
||||
# Ensure we operate on a copy, a shallow copy is fine.
|
||||
payload = payload.copy()
|
||||
|
|
@ -125,6 +131,9 @@ class HoudiniSubmitPublishDeadline(pyblish.api.ContextPlugin):
|
|||
# similar environment using it, e.g. "houdini17.5;pluginx2.3"
|
||||
"AVALON_TOOLS",
|
||||
]
|
||||
# Add mongo url if it's enabled
|
||||
if context.data.get("deadlinePassMongoUrl"):
|
||||
keys.append("OPENPYPE_MONGO")
|
||||
|
||||
environment = dict(
|
||||
{key: os.environ[key] for key in keys if key in os.environ},
|
||||
|
|
|
|||
|
|
@ -101,6 +101,10 @@ class HoudiniSubmitRenderDeadline(pyblish.api.InstancePlugin):
|
|||
# similar environment using it, e.g. "maya2018;vray4.x;yeti3.1.9"
|
||||
"AVALON_TOOLS",
|
||||
]
|
||||
# Add mongo url if it's enabled
|
||||
if context.data.get("deadlinePassMongoUrl"):
|
||||
keys.append("OPENPYPE_MONGO")
|
||||
|
||||
environment = dict({key: os.environ[key] for key in keys
|
||||
if key in os.environ}, **api.Session)
|
||||
|
||||
|
|
|
|||
|
|
@ -498,6 +498,9 @@ class MayaSubmitDeadline(pyblish.api.InstancePlugin):
|
|||
"OPENPYPE_DEV",
|
||||
"OPENPYPE_LOG_NO_COLORS"
|
||||
]
|
||||
# Add mongo url if it's enabled
|
||||
if instance.context.data.get("deadlinePassMongoUrl"):
|
||||
keys.append("OPENPYPE_MONGO")
|
||||
|
||||
environment = dict({key: os.environ[key] for key in keys
|
||||
if key in os.environ}, **api.Session)
|
||||
|
|
|
|||
|
|
@ -249,6 +249,10 @@ class NukeSubmitDeadline(pyblish.api.InstancePlugin):
|
|||
"TOOL_ENV",
|
||||
"FOUNDRY_LICENSE"
|
||||
]
|
||||
# Add mongo url if it's enabled
|
||||
if instance.context.data.get("deadlinePassMongoUrl"):
|
||||
keys.append("OPENPYPE_MONGO")
|
||||
|
||||
# add allowed keys from preset if any
|
||||
if self.env_allowed_keys:
|
||||
keys += self.env_allowed_keys
|
||||
|
|
|
|||
|
|
@ -227,6 +227,11 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin):
|
|||
environment["OPENPYPE_USERNAME"] = instance.context.data["user"]
|
||||
environment["OPENPYPE_PUBLISH_JOB"] = "1"
|
||||
environment["OPENPYPE_RENDER_JOB"] = "0"
|
||||
# Add mongo url if it's enabled
|
||||
if instance.context.data.get("deadlinePassMongoUrl"):
|
||||
mongo_url = os.environ.get("OPENPYPE_MONGO")
|
||||
if mongo_url:
|
||||
environment["OPENPYPE_MONGO"] = mongo_url
|
||||
|
||||
args = [
|
||||
'publish',
|
||||
|
|
@ -273,18 +278,18 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin):
|
|||
else:
|
||||
payload["JobInfo"]["JobDependency0"] = job["_id"]
|
||||
|
||||
i = 0
|
||||
for index, key in enumerate(environment):
|
||||
index = 0
|
||||
for key in environment:
|
||||
if key.upper() in self.enviro_filter:
|
||||
payload["JobInfo"].update(
|
||||
{
|
||||
"EnvironmentKeyValue%d"
|
||||
% i: "{key}={value}".format(
|
||||
% index: "{key}={value}".format(
|
||||
key=key, value=environment[key]
|
||||
)
|
||||
}
|
||||
)
|
||||
i += 1
|
||||
index += 1
|
||||
|
||||
# remove secondary pool
|
||||
payload["JobInfo"].pop("SecondaryPool", None)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"deadline_servers": [],
|
||||
"publish": {
|
||||
"CollectDefaultDeadlineServer": {
|
||||
"pass_mongo_url": false
|
||||
},
|
||||
"ValidateExpectedFiles": {
|
||||
"enabled": true,
|
||||
"active": true,
|
||||
|
|
|
|||
|
|
@ -17,6 +17,19 @@
|
|||
"key": "publish",
|
||||
"label": "Publish plugins",
|
||||
"children": [
|
||||
{
|
||||
"type": "dict",
|
||||
"collapsible": true,
|
||||
"key": "CollectDefaultDeadlineServer",
|
||||
"label": "Default Deadline Webservice",
|
||||
"children": [
|
||||
{
|
||||
"type": "boolean",
|
||||
"key": "pass_mongo_url",
|
||||
"label": "Pass Mongo url to job"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "dict",
|
||||
"collapsible": true,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue