Skip to content

Commit

Permalink
Merge branch 'develop' into enhancement/AY-5714_Provide-user-credenti…
Browse files Browse the repository at this point in the history
…al-fields-on-Deadline-Studio-Settings
  • Loading branch information
kalisp authored Jul 8, 2024
2 parents 3ef8896 + 251973a commit 7018b35
Show file tree
Hide file tree
Showing 10 changed files with 105 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def get_job_info(self):
"AYON_WORKDIR",
"AYON_APP_NAME",
"AYON_LOG_NO_COLORS",
"IS_TEST"
"AYON_IN_TESTS"
]

environment = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def get_job_info(self):
"AYON_TASK_NAME",
"AYON_WORKDIR",
"AYON_APP_NAME",
"IS_TEST"
"AYON_IN_TESTS"
]

environment = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ def process(self, instance):
"AYON_WORKDIR",
"AYON_APP_NAME",
"AYON_LOG_NO_COLORS",
"IS_TEST",
"AYON_IN_TESTS",
"AYON_BUNDLE_NAME",
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ def get_job_info(self):
"AYON_WORKDIR",
"AYON_APP_NAME",
"AYON_LOG_NO_COLORS"
"IS_TEST"
"AYON_IN_TESTS"
]

environment = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,30 @@ class RedshiftRenderPluginInfo():
Version = attr.ib(default="1")


@attr.s
class HuskStandalonePluginInfo():
"""Requires Deadline Husk Standalone Plugin.
See Deadline Plug-in:
https://github.com/BigRoy/HuskStandaloneSubmitter
Also see Husk options here:
https://www.sidefx.com/docs/houdini/ref/utils/husk.html
"""
SceneFile = attr.ib()
# TODO: Below parameters are only supported by custom version of the plugin
Renderer = attr.ib(default=None)
RenderSettings = attr.ib(default="/Render/rendersettings")
Purpose = attr.ib(default="geometry,render")
Complexity = attr.ib(default="veryhigh")
Snapshot = attr.ib(default=-1)
LogLevel = attr.ib(default="2")
PreRender = attr.ib(default="")
PreFrame = attr.ib(default="")
PostFrame = attr.ib(default="")
PostRender = attr.ib(default="")
RestartDelegate = attr.ib(default="")
Version = attr.ib(default="")


class HoudiniSubmitDeadline(
abstract_submit_deadline.AbstractSubmitDeadline,
AYONPyblishPluginMixin
Expand All @@ -69,8 +93,7 @@ class HoudiniSubmitDeadline(
label = "Submit Render to Deadline"
order = pyblish.api.IntegratorOrder
hosts = ["houdini"]
families = ["usdrender",
"redshift_rop",
families = ["redshift_rop",
"arnold_rop",
"mantra_rop",
"karma_rop",
Expand Down Expand Up @@ -149,11 +172,14 @@ def get_job_info(self, dependency_job_ids=None):

job_type = "[RENDER]"
if split_render_job and not is_export_job:
# Convert from family to Deadline plugin name
# i.e., arnold_rop -> Arnold
plugin = (
instance.data["productType"].replace("_rop", "").capitalize()
)
product_type = instance.data["productType"]
plugin = {
"usdrender": "HuskStandalone",
}.get(product_type)
if not plugin:
# Convert from product type to Deadline plugin name
# i.e., arnold_rop -> Arnold
plugin = product_type.replace("_rop", "").capitalize()
else:
plugin = "Houdini"
if split_render_job:
Expand Down Expand Up @@ -185,7 +211,8 @@ def get_job_info(self, dependency_job_ids=None):
# Make sure we make job frame dependent so render tasks pick up a soon
# as export tasks are done
if split_render_job and not is_export_job:
job_info.IsFrameDependent = True
job_info.IsFrameDependent = bool(instance.data.get(
"splitRenderFrameDependent", True))

job_info.Pool = instance.data.get("primaryPool")
job_info.SecondaryPool = instance.data.get("secondaryPool")
Expand All @@ -207,6 +234,13 @@ def get_job_info(self, dependency_job_ids=None):
)
job_info.Group = self.group

# Apply render globals, like e.g. data from collect machine list
render_globals = instance.data.get("renderGlobals", {})
if render_globals:
self.log.debug("Applying 'renderGlobals' to job info: %s",
render_globals)
job_info.update(render_globals)

job_info.Comment = context.data.get("comment")

keys = [
Expand Down Expand Up @@ -292,6 +326,10 @@ def get_plugin_info(self, job_type=None):
" - using version configured in Deadline"
))

elif product_type == "usdrender":
plugin_info = self._get_husk_standalone_plugin_info(
instance, hou_major_minor)

else:
self.log.error(
"Product type '%s' not supported yet to split render job",
Expand Down Expand Up @@ -321,3 +359,45 @@ def process(self, instance):
# Store output dir for unified publisher (filesequence)
output_dir = os.path.dirname(instance.data["files"][0])
instance.data["outputDir"] = output_dir

def _get_husk_standalone_plugin_info(self, instance, hou_major_minor):
# Not all hosts can import this module.
import hou

# Supply additional parameters from the USD Render ROP
# to the Husk Standalone Render Plug-in
rop_node = hou.node(instance.data["instance_node"])
snapshot_interval = -1
if rop_node.evalParm("dosnapshot"):
snapshot_interval = rop_node.evalParm("snapshotinterval")

restart_delegate = 0
if rop_node.evalParm("husk_restartdelegate"):
restart_delegate = rop_node.evalParm("husk_restartdelegateframes")

rendersettings = (
rop_node.evalParm("rendersettings")
or "/Render/rendersettings"
)
return HuskStandalonePluginInfo(
SceneFile=instance.data["ifdFile"],
Renderer=rop_node.evalParm("renderer"),
RenderSettings=rendersettings,
Purpose=rop_node.evalParm("husk_purpose"),
Complexity=rop_node.evalParm("husk_complexity"),
Snapshot=snapshot_interval,
PreRender=rop_node.evalParm("husk_prerender"),
PreFrame=rop_node.evalParm("husk_preframe"),
PostFrame=rop_node.evalParm("husk_postframe"),
PostRender=rop_node.evalParm("husk_postrender"),
RestartDelegate=restart_delegate,
Version=hou_major_minor
)


class HoudiniSubmitDeadlineUsdRender(HoudiniSubmitDeadline):
# Do not use published workfile paths for USD Render ROP because the
# Export Job doesn't seem to occur using the published path either, so
# output paths then do not match the actual rendered paths
use_published = False
families = ["usdrender"]
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def get_job_info(self):
"AYON_TASK_NAME",
"AYON_WORKDIR",
"AYON_APP_NAME",
"IS_TEST",
"AYON_IN_TESTS",
]

environment = {
Expand Down
6 changes: 3 additions & 3 deletions client/ayon_deadline/plugins/publish/submit_maya_deadline.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ def get_job_info(self):
"AYON_TASK_NAME",
"AYON_WORKDIR",
"AYON_APP_NAME",
"IS_TEST"
"AYON_IN_TESTS"
]

environment = {
Expand All @@ -236,7 +236,7 @@ def get_job_info(self):
job_info.EnvironmentKeyValue["AYON_LOG_NO_COLORS"] = "1"

# Adding file dependencies.
if not bool(os.environ.get("IS_TEST")) and self.asset_dependencies:
if not is_in_tests() and self.asset_dependencies:
dependencies = instance.context.data["fileDependencies"]
for dependency in dependencies:
job_info.AssetDependency += dependency
Expand Down Expand Up @@ -589,7 +589,7 @@ def _get_maya_payload(self, data):

job_info = copy.deepcopy(self.job_info)

if not bool(os.environ.get("IS_TEST")) and self.asset_dependencies:
if not is_in_tests() and self.asset_dependencies:
# Asset dependency to wait for at least the scene file to sync.
job_info.AssetDependency += self.scene_path

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def _submit_deadline_post_job(self, instance, job):
"AYON_TASK_NAME": instance.context.data["task"],
"AYON_USERNAME": instance.context.data["user"],
"AYON_LOG_NO_COLORS": "1",
"IS_TEST": str(int(is_in_tests())),
"AYON_IN_TESTS": str(int(is_in_tests())),
"AYON_PUBLISH_JOB": "1",
"AYON_RENDER_JOB": "0",
"AYON_REMOTE_PUBLISH": "0",
Expand Down Expand Up @@ -156,9 +156,6 @@ def _submit_deadline_post_job(self, instance, job):
"--targets", "farm"
]

if is_in_tests():
args.append("--automatic-tests")

# Generate the payload for Deadline submission
secondary_pool = (
self.deadline_pool_secondary or instance.data.get("secondaryPool")
Expand Down
7 changes: 2 additions & 5 deletions client/ayon_deadline/plugins/publish/submit_publish_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin,
"vrayscene", "maxrender",
"arnold_rop", "mantra_rop",
"karma_rop", "vray_rop",
"redshift_rop"]
"redshift_rop", "usdrender"]
settings_category = "deadline"

aov_filter = [
Expand Down Expand Up @@ -206,7 +206,7 @@ def _submit_deadline_post_job(self, instance, job, instances):
"AYON_TASK_NAME": instance.context.data["task"],
"AYON_USERNAME": instance.context.data["user"],
"AYON_LOG_NO_COLORS": "1",
"IS_TEST": str(int(is_in_tests())),
"AYON_IN_TESTS": str(int(is_in_tests())),
"AYON_PUBLISH_JOB": "1",
"AYON_RENDER_JOB": "0",
"AYON_REMOTE_PUBLISH": "0",
Expand Down Expand Up @@ -234,9 +234,6 @@ def _submit_deadline_post_job(self, instance, job, instances):
"--targets", "farm"
]

if is_in_tests():
args.append("--automatic-tests")

# Generate the payload for Deadline submission
secondary_pool = (
self.deadline_pool_secondary or instance.data.get("secondaryPool")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
FileUtils,
DirectoryUtils,
)
__version__ = "1.1.0"
__version__ = "1.1.1"
VERSION_REGEX = re.compile(
r"(?P<major>0|[1-9]\d*)"
r"\.(?P<minor>0|[1-9]\d*)"
Expand Down Expand Up @@ -342,6 +342,7 @@ def inject_openpype_environment(deadlinePlugin):
"envgroup": "farm"
}

# use legacy IS_TEST env var to mark automatic tests for OP
if job.GetJobEnvironmentKeyValue("IS_TEST"):
args.append("--automatic-tests")

Expand Down Expand Up @@ -501,8 +502,6 @@ def inject_ayon_environment(deadlinePlugin):
"extractenvironments",
export_url
]
if job.GetJobEnvironmentKeyValue("IS_TEST"):
args.append("--automatic-tests")

for key, value in add_kwargs.items():
args.extend(["--{}".format(key), value])
Expand All @@ -516,6 +515,10 @@ def inject_ayon_environment(deadlinePlugin):
"AYON_API_KEY": ayon_api_key,
"AYON_BUNDLE_NAME": ayon_bundle_name,
}

automatic_tests = job.GetJobEnvironmentKeyValue("AYON_IN_TESTS")
if automatic_tests:
environment["AYON_IN_TESTS"] = automatic_tests
for env, val in environment.items():
# Add the env var for the Render Plugin that is about to render
deadlinePlugin.SetEnvironmentVariable(env, val)
Expand Down

0 comments on commit 7018b35

Please sign in to comment.