From f62754bf7a596aea87515b90b13384fc9a3f6c75 Mon Sep 17 00:00:00 2001 From: Mark Wiebe <399551+mwiebe@users.noreply.github.com> Date: Wed, 13 Sep 2023 00:00:05 -0700 Subject: [PATCH] refactor!: Update for the deadline-cloud queue env changes BREAKING-CHANGE: This requires the deadline-cloud interface changes created to support Queue Environment parameters. - Updated the function call patterns for the widgets and callback functions. - Renamed FlatAssetReferences to AssetReferences. - Removed the RezPackages parameter from the default template, updated the logic to apply modifications to the queue parameter RezPackages if it exists. - Updated the job bundle output tests, verified the changes are as expected by hand. --- DEVELOPMENT.md | 13 ++- .../expected_job_bundle/asset_references.yaml | 1 + .../expected_job_bundle/parameter_values.yaml | 18 ++-- .../cube/expected_job_bundle/template.yaml | 9 -- job_bundle_output_tests/cube/scene/cube.ma | 8 +- .../expected_job_bundle/asset_references.yaml | 1 + .../expected_job_bundle/parameter_values.yaml | 18 ++-- .../layers/expected_job_bundle/template.yaml | 9 -- .../layers/scene/layers.ma | 10 +- .../expected_job_bundle/asset_references.yaml | 1 + .../expected_job_bundle/parameter_values.yaml | 18 ++-- .../expected_job_bundle/template.yaml | 9 -- .../scene/layers_no_variation.ma | 6 +- scripts/build_wheels.sh | 14 +++ src/deadline/maya_submitter/data_classes.py | 8 +- .../default_maya_job_template.yaml | 8 -- .../maya_submitter/maya_render_submitter.py | 102 +++++++++--------- 17 files changed, 112 insertions(+), 141 deletions(-) create mode 100644 scripts/build_wheels.sh diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 2737ff8..e504db3 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -48,17 +48,16 @@ your build of the adaptor for the one in the service. 1. Use the development location from the Submitter Development Workflow. Make sure you're running Maya with `set DEADLINE_ENABLE_DEVELOPER_OPTIONS=true` enabled. -2. Build wheels for `openjd`, `deadline` and `deadline-cloud-for-maya`. +2. Build wheels for `openjd`, `deadline` and `deadline-cloud-for-maya`, place them in a "wheels" + folder in `deadline-cloud-for-maya`. A script is provided to do this, just execute from `deadline-cloud-for-maya`: ``` # If you don't have the build package installed already $ pip install build ... - $ mkdir wheels; \ - rm wheels/*; \ - for dir in ../openjd ../deadline-cloud ../deadline-cloud-for-maya; \ - do python -m build --wheel --outdir ./wheels --skip-dependency-check $dir; \ - done - ... + $ ./scripts/build_wheels.sh + ``` + Wheels should been generated in the "wheels" folder: + ``` $ ls ./wheels deadline_cloud_for_maya--py3-none-any.whl deadline--py3-none-any.whl diff --git a/job_bundle_output_tests/cube/expected_job_bundle/asset_references.yaml b/job_bundle_output_tests/cube/expected_job_bundle/asset_references.yaml index 20b7336..d8176b4 100644 --- a/job_bundle_output_tests/cube/expected_job_bundle/asset_references.yaml +++ b/job_bundle_output_tests/cube/expected_job_bundle/asset_references.yaml @@ -8,3 +8,4 @@ assetReferences: outputs: directories: - /normalized/job/bundle/dir/images + referencedPaths: [] diff --git a/job_bundle_output_tests/cube/expected_job_bundle/parameter_values.yaml b/job_bundle_output_tests/cube/expected_job_bundle/parameter_values.yaml index aa3a1c9..1680b84 100644 --- a/job_bundle_output_tests/cube/expected_job_bundle/parameter_values.yaml +++ b/job_bundle_output_tests/cube/expected_job_bundle/parameter_values.yaml @@ -1,12 +1,4 @@ parameterValues: -- name: deadline:priority - value: 50 -- name: deadline:targetTaskRunStatus - value: READY -- name: deadline:maxFailedTasksCount - value: 20 -- name: deadline:maxRetriesPerTask - value: 5 - name: MayaSceneFile value: /normalized/job/bundle/dir/cube.ma - name: Frames @@ -23,5 +15,11 @@ parameterValues: value: /normalized/job/bundle/dir/images - name: RenderSetupIncludeLights value: 'true' -- name: RezPackages - value: mayaIO mtoa deadline_cloud_for_maya +- name: deadline:targetTaskRunStatus + value: READY +- name: deadline:maxFailedTasksCount + value: 20 +- name: deadline:maxRetriesPerTask + value: 5 +- name: deadline:priority + value: 50 diff --git a/job_bundle_output_tests/cube/expected_job_bundle/template.yaml b/job_bundle_output_tests/cube/expected_job_bundle/template.yaml index d7165bb..338de3c 100644 --- a/job_bundle_output_tests/cube/expected_job_bundle/template.yaml +++ b/job_bundle_output_tests/cube/expected_job_bundle/template.yaml @@ -66,15 +66,6 @@ parameterDefinitions: allowedValues: - 'true' - 'false' -- name: RezPackages - type: STRING - userInterface: - control: LINE_EDIT - label: Rez Packages - groupLabel: Software Environment - description: A space-separated list of Rez packages to install. Requires a Queue - Environment to handle the env creation. - default: mayaIO mtoa deadline_cloud_for_maya - name: OutputFilePrefix type: STRING userInterface: diff --git a/job_bundle_output_tests/cube/scene/cube.ma b/job_bundle_output_tests/cube/scene/cube.ma index 51b5658..eeaccda 100644 --- a/job_bundle_output_tests/cube/scene/cube.ma +++ b/job_bundle_output_tests/cube/scene/cube.ma @@ -4,10 +4,10 @@ //Codeset: 1252 file -rdi 1 -ns "scene_file_to_reference" -rfn "scene_file_to_referenceRN" -op "VERS|2023|UVER|undef|MADE|undef|CHNG|Wed, Aug 30, 2023 02:59:28 PM|ICON|undef|INFO|undef|OBJN|21|INCL|undef(|LUNI|cm|TUNI|film|AUNI|deg|TDUR|141120000|" - -typ "mayaBinary" "C:/Users/markw/deadline-clients/deadline-cloud-for-maya/job_bundle_output_tests//cube/scene_file_to_reference.mb"; + -typ "mayaBinary" "D:/deadline-clients/deadline-cloud-for-maya/job_bundle_output_tests//cube/scene_file_to_reference.mb"; file -r -ns "scene_file_to_reference" -dr 1 -rfn "scene_file_to_referenceRN" -op "VERS|2023|UVER|undef|MADE|undef|CHNG|Wed, Aug 30, 2023 02:59:28 PM|ICON|undef|INFO|undef|OBJN|21|INCL|undef(|LUNI|cm|TUNI|film|AUNI|deg|TDUR|141120000|" - -typ "mayaBinary" "C:/Users/markw/deadline-clients/deadline-cloud-for-maya/job_bundle_output_tests//cube/scene_file_to_reference.mb"; + -typ "mayaBinary" "D:/deadline-clients/deadline-cloud-for-maya/job_bundle_output_tests//cube/scene_file_to_reference.mb"; requires maya "2023"; requires "stereoCamera" "10.0"; requires -nodeType "aiOptions" -nodeType "aiAOVDriver" -nodeType "aiAOVFilter" "mtoa" "5.1.0"; @@ -188,13 +188,13 @@ createNode materialInfo -n "materialInfo1"; rename -uid "B803D1DE-4EE6-CFD3-DEC1-BD90C863A0EA"; createNode file -n "file1"; rename -uid "1BAA2EE5-46EB-ED01-BE45-9888E95529F2"; - setAttr ".ftn" -type "string" "C:/Users/markw/deadline-clients/deadline-cloud-for-maya/job_bundle_output_tests//cube/deadline_logo_48x48.png"; + setAttr ".ftn" -type "string" "D:/deadline-clients/deadline-cloud-for-maya/job_bundle_output_tests//cube/deadline_logo_48x48.png"; setAttr ".cs" -type "string" "sRGB"; createNode place2dTexture -n "place2dTexture1"; rename -uid "CEF90DC0-44C4-11AF-47D0-97B5269B63A4"; createNode reference -n "scene_file_to_referenceRN"; rename -uid "9FAAF201-4C9E-4E6C-9DC3-359F06356F1E"; - setAttr ".ed" -type "dataReferenceEdits" + setAttr ".ed" -type "dataReferenceEdits" "scene_file_to_referenceRN" "scene_file_to_referenceRN" 0; setAttr ".ptag" -type "string" ""; diff --git a/job_bundle_output_tests/layers/expected_job_bundle/asset_references.yaml b/job_bundle_output_tests/layers/expected_job_bundle/asset_references.yaml index 4b1fed1..b5845ee 100644 --- a/job_bundle_output_tests/layers/expected_job_bundle/asset_references.yaml +++ b/job_bundle_output_tests/layers/expected_job_bundle/asset_references.yaml @@ -16,3 +16,4 @@ assetReferences: - /normalized/job/bundle/dir/images/renderSetupLayer2/camera3 - /normalized/job/bundle/dir/images/renderSetupLayer4/camera1 - /normalized/job/bundle/dir/images/renderSetupLayer4/persp + referencedPaths: [] diff --git a/job_bundle_output_tests/layers/expected_job_bundle/parameter_values.yaml b/job_bundle_output_tests/layers/expected_job_bundle/parameter_values.yaml index 2d5c931..758f723 100644 --- a/job_bundle_output_tests/layers/expected_job_bundle/parameter_values.yaml +++ b/job_bundle_output_tests/layers/expected_job_bundle/parameter_values.yaml @@ -1,12 +1,4 @@ parameterValues: -- name: deadline:priority - value: 50 -- name: deadline:targetTaskRunStatus - value: READY -- name: deadline:maxFailedTasksCount - value: 20 -- name: deadline:maxRetriesPerTask - value: 5 - name: MayaSceneFile value: /normalized/job/bundle/dir/layers.ma - name: layerDefaultFramesFrames @@ -57,5 +49,11 @@ parameterValues: value: 'true' - name: ArnoldErrorOnLicenseFailure value: 'false' -- name: RezPackages - value: mayaIO mtoa deadline_cloud_for_maya +- name: deadline:targetTaskRunStatus + value: READY +- name: deadline:maxFailedTasksCount + value: 20 +- name: deadline:maxRetriesPerTask + value: 5 +- name: deadline:priority + value: 50 diff --git a/job_bundle_output_tests/layers/expected_job_bundle/template.yaml b/job_bundle_output_tests/layers/expected_job_bundle/template.yaml index c99bfae..7073acd 100644 --- a/job_bundle_output_tests/layers/expected_job_bundle/template.yaml +++ b/job_bundle_output_tests/layers/expected_job_bundle/template.yaml @@ -58,15 +58,6 @@ parameterDefinitions: allowedValues: - 'true' - 'false' -- name: RezPackages - type: STRING - userInterface: - control: LINE_EDIT - label: Rez Packages - groupLabel: Software Environment - description: A space-separated list of Rez packages to install. Requires a Queue - Environment to handle the env creation. - default: mayaIO mtoa deadline_cloud_for_maya - name: layerDefaultFramesFrames type: STRING userInterface: diff --git a/job_bundle_output_tests/layers/scene/layers.ma b/job_bundle_output_tests/layers/scene/layers.ma index d11c7d9..0474511 100644 --- a/job_bundle_output_tests/layers/scene/layers.ma +++ b/job_bundle_output_tests/layers/scene/layers.ma @@ -4,10 +4,10 @@ //Codeset: 1252 file -rdi 1 -ns "scene_file_to_reference" -rfn "scene_file_to_referenceRN" -op "VERS|2023|UVER|undef|MADE|undef|CHNG|Wed, Aug 30, 2023 02:59:28 PM|ICON|undef|INFO|undef|OBJN|21|INCL|undef(|LUNI|cm|TUNI|film|AUNI|deg|TDUR|141120000|" - -typ "mayaBinary" "C:/Users/markw/deadline-clients/deadline-cloud-for-maya/job_bundle_output_tests/layers/scene/scene_file_to_reference.mb"; + -typ "mayaBinary" "D:/deadline-clients/deadline-cloud-for-maya/job_bundle_output_tests/layers/scene/scene_file_to_reference.mb"; file -r -ns "scene_file_to_reference" -dr 1 -rfn "scene_file_to_referenceRN" -op "VERS|2023|UVER|undef|MADE|undef|CHNG|Wed, Aug 30, 2023 02:59:28 PM|ICON|undef|INFO|undef|OBJN|21|INCL|undef(|LUNI|cm|TUNI|film|AUNI|deg|TDUR|141120000|" - -typ "mayaBinary" "C:/Users/markw/deadline-clients/deadline-cloud-for-maya/job_bundle_output_tests/layers/scene/scene_file_to_reference.mb"; + -typ "mayaBinary" "D:/deadline-clients/deadline-cloud-for-maya/job_bundle_output_tests/layers/scene/scene_file_to_reference.mb"; requires maya "2023"; requires "stereoCamera" "10.0"; requires -nodeType "aiOptions" -nodeType "aiAOVDriver" -nodeType "aiAOVFilter" "mtoa" "5.1.0"; @@ -383,7 +383,7 @@ createNode simpleSelector -n "collection1Selector"; setAttr ".tf" 4; createNode reference -n "scene_file_to_referenceRN"; rename -uid "C918C559-4A3A-DEDF-08EC-F796E312D2DE"; - setAttr ".ed" -type "dataReferenceEdits" + setAttr ".ed" -type "dataReferenceEdits" "scene_file_to_referenceRN" "scene_file_to_referenceRN" 0; setAttr ".ptag" -type "string" ""; @@ -521,7 +521,7 @@ createNode absOverride -n "renderable5"; setAttr ".es" yes; createNode absUniqueOverride -n "imageFormat"; rename -uid "BF6B15F6-4AF8-A704-31D6-4CB52DCE4F3E"; - addAttr -ci true -sn "atv" -ln "attrValue" -min 0 -max 63 -en "GIF:SoftImage:RLA:Tiff:Tiff16:SGI:Alias PIX:Maya IFF:JPEG:EPS:Maya16 IFF:Quantel=12:SGI16:Targa=19:Windows Bitmap:SGI Movie:Quicktime:AVI:MacPaint=30:PSD:PNG:QuickDraw:QuickTime Image:DDS:PSD Layered:EXR(exr)=40:IMF plugin=50:Custom Image Format:Macromedia SWF (swf)=60:Adobe Illustrator (ai):SVG (svg):Swift3DImporter (swft)" + addAttr -ci true -sn "atv" -ln "attrValue" -min 0 -max 63 -en "GIF:SoftImage:RLA:Tiff:Tiff16:SGI:Alias PIX:Maya IFF:JPEG:EPS:Maya16 IFF:Quantel=12:SGI16:Targa=19:Windows Bitmap:SGI Movie:Quicktime:AVI:MacPaint=30:PSD:PNG:QuickDraw:QuickTime Image:DDS:PSD Layered:EXR(exr)=40:IMF plugin=50:Custom Image Format:Macromedia SWF (swf)=60:Adobe Illustrator (ai):SVG (svg):Swift3DImporter (swft)" -at "enum"; setAttr ".atr" -type "string" "imageFormat"; setAttr ".tgName" -type "string" "defaultRenderGlobals"; @@ -564,7 +564,7 @@ createNode simpleSelector -n "RenderSettingsCollection4Selector"; setAttr ".tf" 0; createNode absUniqueOverride -n "imageFormat1"; rename -uid "370CC408-469D-C882-B66D-35B5096546AB"; - addAttr -ci true -sn "atv" -ln "attrValue" -min 0 -max 63 -en "GIF:SoftImage:RLA:Tiff:Tiff16:SGI:Alias PIX:Maya IFF:JPEG:EPS:Maya16 IFF:Quantel=12:SGI16:Targa=19:Windows Bitmap:SGI Movie:Quicktime:AVI:MacPaint=30:PSD:PNG:QuickDraw:QuickTime Image:DDS:PSD Layered:EXR(exr)=40:IMF plugin=50:Custom Image Format:Macromedia SWF (swf)=60:Adobe Illustrator (ai):SVG (svg):Swift3DImporter (swft)" + addAttr -ci true -sn "atv" -ln "attrValue" -min 0 -max 63 -en "GIF:SoftImage:RLA:Tiff:Tiff16:SGI:Alias PIX:Maya IFF:JPEG:EPS:Maya16 IFF:Quantel=12:SGI16:Targa=19:Windows Bitmap:SGI Movie:Quicktime:AVI:MacPaint=30:PSD:PNG:QuickDraw:QuickTime Image:DDS:PSD Layered:EXR(exr)=40:IMF plugin=50:Custom Image Format:Macromedia SWF (swf)=60:Adobe Illustrator (ai):SVG (svg):Swift3DImporter (swft)" -at "enum"; setAttr ".atr" -type "string" "imageFormat"; setAttr ".tgName" -type "string" "defaultRenderGlobals"; diff --git a/job_bundle_output_tests/layers_no_variation/expected_job_bundle/asset_references.yaml b/job_bundle_output_tests/layers_no_variation/expected_job_bundle/asset_references.yaml index 9cec5fb..bdb3363 100644 --- a/job_bundle_output_tests/layers_no_variation/expected_job_bundle/asset_references.yaml +++ b/job_bundle_output_tests/layers_no_variation/expected_job_bundle/asset_references.yaml @@ -9,3 +9,4 @@ assetReferences: - /normalized/job/bundle/dir/images/layerTheFIrst - /normalized/job/bundle/dir/images/layerTheSecond - /normalized/job/bundle/dir/images/masterLayer + referencedPaths: [] diff --git a/job_bundle_output_tests/layers_no_variation/expected_job_bundle/parameter_values.yaml b/job_bundle_output_tests/layers_no_variation/expected_job_bundle/parameter_values.yaml index 4f24bd4..e182b48 100644 --- a/job_bundle_output_tests/layers_no_variation/expected_job_bundle/parameter_values.yaml +++ b/job_bundle_output_tests/layers_no_variation/expected_job_bundle/parameter_values.yaml @@ -1,12 +1,4 @@ parameterValues: -- name: deadline:priority - value: 50 -- name: deadline:targetTaskRunStatus - value: READY -- name: deadline:maxFailedTasksCount - value: 20 -- name: deadline:maxRetriesPerTask - value: 5 - name: MayaSceneFile value: /normalized/job/bundle/dir/layers_no_variation.ma - name: Frames @@ -25,5 +17,11 @@ parameterValues: value: 'true' - name: ArnoldErrorOnLicenseFailure value: 'false' -- name: RezPackages - value: mayaIO mtoa deadline_cloud_for_maya +- name: deadline:targetTaskRunStatus + value: READY +- name: deadline:maxFailedTasksCount + value: 20 +- name: deadline:maxRetriesPerTask + value: 5 +- name: deadline:priority + value: 50 diff --git a/job_bundle_output_tests/layers_no_variation/expected_job_bundle/template.yaml b/job_bundle_output_tests/layers_no_variation/expected_job_bundle/template.yaml index fa2c02c..2dd9eb7 100644 --- a/job_bundle_output_tests/layers_no_variation/expected_job_bundle/template.yaml +++ b/job_bundle_output_tests/layers_no_variation/expected_job_bundle/template.yaml @@ -66,15 +66,6 @@ parameterDefinitions: allowedValues: - 'true' - 'false' -- name: RezPackages - type: STRING - userInterface: - control: LINE_EDIT - label: Rez Packages - groupLabel: Software Environment - description: A space-separated list of Rez packages to install. Requires a Queue - Environment to handle the env creation. - default: mayaIO mtoa deadline_cloud_for_maya - name: OutputFilePrefix type: STRING userInterface: diff --git a/job_bundle_output_tests/layers_no_variation/scene/layers_no_variation.ma b/job_bundle_output_tests/layers_no_variation/scene/layers_no_variation.ma index 5b7c773..5e03dfc 100644 --- a/job_bundle_output_tests/layers_no_variation/scene/layers_no_variation.ma +++ b/job_bundle_output_tests/layers_no_variation/scene/layers_no_variation.ma @@ -4,10 +4,10 @@ //Codeset: 1252 file -rdi 1 -ns "scene_file_to_reference" -rfn "scene_file_to_referenceRN" -op "VERS|2023|UVER|undef|MADE|undef|CHNG|Wed, Aug 30, 2023 02:59:28 PM|ICON|undef|INFO|undef|OBJN|21|INCL|undef(|LUNI|cm|TUNI|film|AUNI|deg|TDUR|141120000|" - -typ "mayaBinary" "C:/Users/markw/deadline-clients/deadline-cloud-for-maya/job_bundle_output_tests/layers_no_variation/scene/scene_file_to_reference.mb"; + -typ "mayaBinary" "D:/deadline-clients/deadline-cloud-for-maya/job_bundle_output_tests/layers_no_variation/scene/scene_file_to_reference.mb"; file -r -ns "scene_file_to_reference" -dr 1 -rfn "scene_file_to_referenceRN" -op "VERS|2023|UVER|undef|MADE|undef|CHNG|Wed, Aug 30, 2023 02:59:28 PM|ICON|undef|INFO|undef|OBJN|21|INCL|undef(|LUNI|cm|TUNI|film|AUNI|deg|TDUR|141120000|" - -typ "mayaBinary" "C:/Users/markw/deadline-clients/deadline-cloud-for-maya/job_bundle_output_tests/layers_no_variation/scene/scene_file_to_reference.mb"; + -typ "mayaBinary" "D:/deadline-clients/deadline-cloud-for-maya/job_bundle_output_tests/layers_no_variation/scene/scene_file_to_reference.mb"; requires maya "2023"; requires "stereoCamera" "10.0"; requires -nodeType "aiOptions" -nodeType "aiAOVDriver" -nodeType "aiAOVFilter" "mtoa" "5.1.0"; @@ -202,7 +202,7 @@ createNode script -n "sceneConfigurationScriptNode"; setAttr ".st" 6; createNode reference -n "scene_file_to_referenceRN"; rename -uid "E80FD48A-47F8-9D5B-2E45-52AD9FE11F56"; - setAttr ".ed" -type "dataReferenceEdits" + setAttr ".ed" -type "dataReferenceEdits" "scene_file_to_referenceRN" "scene_file_to_referenceRN" 0; setAttr ".ptag" -type "string" ""; diff --git a/scripts/build_wheels.sh b/scripts/build_wheels.sh new file mode 100644 index 0000000..779b03f --- /dev/null +++ b/scripts/build_wheels.sh @@ -0,0 +1,14 @@ +#!/bin/bash +# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + +set -euo pipefail + +if [ ! -d wheels ]; then + mkdir wheels +fi +rm -f wheels/* + +for dir in ../openjobio ../deadline-cloud ../deadline-cloud-for-maya; do + echo "Building $dir..." + python -m build --wheel --outdir ./wheels --skip-dependency-check $dir +done diff --git a/src/deadline/maya_submitter/data_classes.py b/src/deadline/maya_submitter/data_classes.py index bfafe71..9367437 100644 --- a/src/deadline/maya_submitter/data_classes.py +++ b/src/deadline/maya_submitter/data_classes.py @@ -19,18 +19,14 @@ class RenderSubmitterUISettings: """ submitter_name: str = field(default="Maya") + name: str = field(default="", metadata={"sticky": True}) description: str = field(default="", metadata={"sticky": True}) - initial_status: str = field(default="READY", metadata={"sticky": True}) - max_failed_tasks_count: int = field(default=20, metadata={"sticky": True}) - max_retries_per_task: int = field(default=5, metadata={"sticky": True}) - priority: int = field(default=50, metadata={"sticky": True}) + override_frame_range: bool = field(default=False, metadata={"sticky": True}) frame_list: str = field(default="", metadata={"sticky": True}) project_path: str = field(default="") output_path: str = field(default="") - override_rez_packages: bool = field(default=True) - rez_packages: str = field(default="") input_filenames: list[str] = field(default_factory=list, metadata={"sticky": True}) input_directories: list[str] = field(default_factory=list, metadata={"sticky": True}) diff --git a/src/deadline/maya_submitter/default_maya_job_template.yaml b/src/deadline/maya_submitter/default_maya_job_template.yaml index 20d3418..3b20b34 100644 --- a/src/deadline/maya_submitter/default_maya_job_template.yaml +++ b/src/deadline/maya_submitter/default_maya_job_template.yaml @@ -67,14 +67,6 @@ parameterDefinitions: allowedValues: - 'true' - 'false' -- name: RezPackages - type: STRING - userInterface: - control: LINE_EDIT - label: Rez Packages - groupLabel: Software Environment - description: A space-separated list of Rez packages to install. Requires a Queue Environment to handle the env creation. - default: mayaIO mtoa deadline_cloud_for_maya steps: - name: Render parameterSpace: diff --git a/src/deadline/maya_submitter/maya_render_submitter.py b/src/deadline/maya_submitter/maya_render_submitter.py index 3d96284..f8d9525 100644 --- a/src/deadline/maya_submitter/maya_render_submitter.py +++ b/src/deadline/maya_submitter/maya_render_submitter.py @@ -33,7 +33,7 @@ ) from .cameras import get_renderable_camera_names, ALL_CAMERAS from .ui.components.scene_settings_tab import SceneSettingsWidget -from deadline.client.job_bundle.submission import FlatAssetReferences +from deadline.client.job_bundle.submission import AssetReferences logger = getLogger(__name__) @@ -297,9 +297,9 @@ def _get_job_template( job_template["parameterDefinitions"].extend(override_environment["parameterDefinitions"]) # Add the environment to the end of the template's job environments - if "environments" not in job_template: - job_template["environments"] = [] - job_template["environments"].append(override_environment["environment"]) + if "jobEnvironments" not in job_template: + job_template["jobEnvironments"] = [] + job_template["jobEnvironments"].append(override_environment["environment"]) return job_template @@ -308,14 +308,9 @@ def _get_parameter_values( settings: RenderSubmitterUISettings, renderers: set[str], render_layers: list[RenderLayerData], - default_rez_packages: str, -) -> dict[str, Any]: - parameter_values = [ - {"name": "deadline:priority", "value": settings.priority}, - {"name": "deadline:targetTaskRunStatus", "value": settings.initial_status}, - {"name": "deadline:maxFailedTasksCount", "value": settings.max_failed_tasks_count}, - {"name": "deadline:maxRetriesPerTask", "value": settings.max_retries_per_task}, - ] + queue_parameters: list[dict[str, Any]], +) -> list[dict[str, Any]]: + parameter_values: list[dict[str, Any]] = [] # Set the Maya scene file value parameter_values.append({"name": "MayaSceneFile", "value": Scene.name()}) @@ -398,21 +393,37 @@ def _get_parameter_values( } ) - # Set the RezPackages parameter value if their overridden or we need - # to modify them due to the include_adaptor_wheels setting. - if settings.override_rez_packages or settings.include_adaptor_wheels: - if settings.override_rez_packages: - rez_packages = settings.rez_packages - else: - rez_packages = default_rez_packages - # If the adaptor wheels are included, remove the deadline_cloud_for_maya rez package - if settings.include_adaptor_wheels: - rez_packages = " ".join( - pkg for pkg in rez_packages.split() if not pkg.startswith("deadline_cloud_for_maya") + # Check for any overlap between the job parameters we've defined and the + # queue parameters. This is an error, as we weren't synchronizing the values + # between the two different tabs where they came from. + parameter_names = {param["name"] for param in parameter_values} + queue_parameter_names = {param["name"] for param in queue_parameters} + parameter_overlap = parameter_names.intersection(queue_parameter_names) + if parameter_overlap: + raise DeadlineOperationError( + "The following queue parameters conflict with the Maya job parameters:\n" + + f"{', '.join(parameter_overlap)}" + ) + + # If we're overriding the adaptor with wheels, remove deadline_cloud_for_maya from the RezPackages + if settings.include_adaptor_wheels: + rez_param = {} + # Find the RezPackages parameter definition + for param in queue_parameters: + if param["name"] == "RezPackages": + rez_param = param + break + # Remove the deadline_cloud_for_maya rez package + if rez_param: + rez_param["value"] = " ".join( + pkg for pkg in rez_param["value"].split() if not pkg.startswith("deadline_cloud_for_maya") ) - parameter_values.append({"name": "RezPackages", "value": rez_packages}) - return {"parameterValues": parameter_values} + parameter_values.extend( + {"name": param["name"], "value": param["value"]} for param in queue_parameters + ) + + return parameter_values def show_maya_render_submitter(parent, f=Qt.WindowFlags()) -> "Optional[SubmitJobToDeadlineDialog]": @@ -427,19 +438,6 @@ def show_maya_render_submitter(parent, f=Qt.WindowFlags()) -> "Optional[SubmitJo render_settings.project_path = Scene.project_path() render_settings.output_path = Scene.output_path() - # Get the RezPackages parameter definition, and use the default set there - rez_package_param = [ - param - for param in default_job_template["parameterDefinitions"] - if param["name"] == "RezPackages" - ] - if rez_package_param: - default_rez_packages = render_settings.rez_packages = rez_package_param[0].get( - "default", "" - ) - else: - default_rez_packages = "" - # Load the sticky settings render_settings.load_sticky_settings(Scene.name()) @@ -503,11 +501,12 @@ def show_maya_render_submitter(parent, f=Qt.WindowFlags()) -> "Optional[SubmitJo all_layer_selectable_cameras ) - def job_bundle_callback( + def on_create_job_bundle_callback( widget: SubmitJobToDeadlineDialog, - settings: RenderSubmitterUISettings, job_bundle_dir: str, - asset_references: FlatAssetReferences, + settings: RenderSubmitterUISettings, + queue_parameters: list[dict[str, Any]], + asset_references: AssetReferences, ) -> None: job_bundle_path = Path(job_bundle_dir) @@ -568,27 +567,27 @@ def job_bundle_callback( current_layer_selectable_cameras, ) parameter_values = _get_parameter_values( - settings, renderers, submit_render_layers, default_rez_packages + settings, renderers, submit_render_layers, queue_parameters ) with open(job_bundle_path / "template.yaml", "w", encoding="utf8") as f: deadline_yaml_dump(job_template, f, indent=1) with open(job_bundle_path / "parameter_values.yaml", "w", encoding="utf8") as f: - deadline_yaml_dump(parameter_values, f, indent=1) + deadline_yaml_dump({"parameterValues": parameter_values}, f, indent=1) with open(job_bundle_path / "asset_references.yaml", "w", encoding="utf8") as f: deadline_yaml_dump(asset_references.to_dict(), f, indent=1) # Save Sticky Settings - attachments: FlatAssetReferences = widget.job_attachments.attachments + attachments: AssetReferences = widget.job_attachments.attachments settings.input_filenames = sorted(attachments.input_filenames) settings.input_directories = sorted(attachments.input_directories) settings.input_filenames = sorted(attachments.input_filenames) settings.save_sticky_settings(Scene.name()) - auto_detected_attachments = FlatAssetReferences() + auto_detected_attachments = AssetReferences() introspector = AssetIntrospector() auto_detected_attachments.input_filenames = set( os.path.normpath(path) for path in introspector.parse_scene_assets() @@ -597,18 +596,19 @@ def job_bundle_callback( for layer_data in render_layers: auto_detected_attachments.output_directories.update(layer_data.output_directories) - attachments = FlatAssetReferences( + attachments = AssetReferences( input_filenames=set(render_settings.input_filenames), input_directories=set(render_settings.input_directories), output_directories=set(render_settings.output_directories), ) submitter_dialog = SubmitJobToDeadlineDialog( - SceneSettingsWidget, - render_settings, - auto_detected_attachments, - attachments, - job_bundle_callback, + job_setup_widget_type=SceneSettingsWidget, + initial_job_settings=render_settings, + initial_shared_parameter_values={"RezPackages": "mayaIO mtoa deadline_cloud_for_maya"}, + auto_detected_attachments=auto_detected_attachments, + attachments=attachments, + on_create_job_bundle_callback=on_create_job_bundle_callback, parent=parent, f=f, )