Skip to content

Commit

Permalink
feat: Remove the Rez job environment from the generated job bundles
Browse files Browse the repository at this point in the history
After this change, the queue that this submits jobs to will need either:

1. The dependent software is installed and in the system PATH for the
   workers.
2. The queue has a queue environment that accepts the RezPackages
   parameter and creates a rez environment for the render to use.

Also, put in logic to exclude the deadline_cloud_for_maya rez package
when the developer option include_adaptor_wheels is enabled.

Ran into an error loading sticky settings when removing the rez packages
from sticky settings, so rewrote the load & save logic for them to be
more simple and direct instead of using a special persistent data class
object, and to ignore problems in the sticky settings file instead of
failing to load.

Had to reduce the coverage target from 50 to 45.

Signed-off-by: Mark Wiebe <[email protected]>
  • Loading branch information
mwiebe committed Sep 9, 2023
1 parent 751ec6c commit a63b4ae
Show file tree
Hide file tree
Showing 13 changed files with 146 additions and 673 deletions.
91 changes: 2 additions & 89 deletions job_bundle_output_tests/cube/expected_job_bundle/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ parameters:
control: LINE_EDIT
label: Rez Packages
groupLabel: Software Environment
description: A space-separated list of Rez packages to install
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
Expand All @@ -97,94 +98,6 @@ parameters:
groupLabel: Maya Settings
minValue: 1
description: The image height of the output.
environments:
- name: Rez
description: Initializes and destroys the Rez environment for the run
script:
actions:
onEnter:
command: '{{Env.File.Enter}}'
onExit:
command: '{{Env.File.Exit}}'
embeddedFiles:
- name: Enter
filename: rez-enter.sh
type: TEXT
runnable: true
data: |
#!/bin/env bash
set -euo pipefail
if [ ! -z "{{Param.RezPackages}}" ]; then
echo "Rez Package List:"
echo " {{Param.RezPackages}}"
# Create the environment
/usr/local/bin/deadline-rez init \
-d "{{Session.WorkingDirectory}}" \
{{Param.RezPackages}}
# Capture the environment's vars
{{Env.File.InitialVars}}
. /usr/local/bin/deadline-rez activate \
-d "{{Session.WorkingDirectory}}"
{{Env.File.CaptureVars}}
else
echo "No Rez Packages, skipping environment creation."
fi
- name: Exit
filename: rez-exit.sh
type: TEXT
runnable: true
data: |
#!/bin/env bash
set -euo pipefail
if [ ! -z "{{Param.RezPackages}}" ]; then
echo "Rez Package List:"
echo " {{Param.RezPackages}}"
/usr/local/bin/deadline-rez destroy \
-d "{{ Session.WorkingDirectory }}"
else
echo "No Rez Packages, skipping environment teardown."
fi
- name: InitialVars
filename: initial-vars.sh
type: TEXT
runnable: true
data: |
#!/usr/bin/env python3
import os, json
envfile = "{{Session.WorkingDirectory}}/.envInitial"
with open(envfile, "w", encoding="utf8") as f:
json.dump(dict(os.environ), f)
- name: CaptureVars
filename: capture-vars.sh
type: TEXT
runnable: true
data: |
#!/usr/bin/env python3
import os, json, sys
envfile = "{{Session.WorkingDirectory}}/.envInitial"
if os.path.isfile(envfile):
with open(envfile, "r", encoding="utf8") as f:
before = json.load(f)
else:
print("No initial environment found, must run Env.File.CaptureVars script first")
sys.exit(1)
after = dict(os.environ)
put = {k: v for k, v in after.items() if v != before.get(k)}
delete = {k for k in before if k not in after}
for k, v in put.items():
print(f"updating {k}={v}")
print(f"openjobio_env: {k}={v}")
for k in delete:
print(f"openjobio_unset_env: {k}")
steps:
- name: masterLayer
parameterSpace:
Expand Down
91 changes: 2 additions & 89 deletions job_bundle_output_tests/layers/expected_job_bundle/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ parameters:
control: LINE_EDIT
label: Rez Packages
groupLabel: Software Environment
description: A space-separated list of Rez packages to install
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
Expand Down Expand Up @@ -232,94 +233,6 @@ parameters:
allowedValues:
- 'true'
- 'false'
environments:
- name: Rez
description: Initializes and destroys the Rez environment for the run
script:
actions:
onEnter:
command: '{{Env.File.Enter}}'
onExit:
command: '{{Env.File.Exit}}'
embeddedFiles:
- name: Enter
filename: rez-enter.sh
type: TEXT
runnable: true
data: |
#!/bin/env bash
set -euo pipefail
if [ ! -z "{{Param.RezPackages}}" ]; then
echo "Rez Package List:"
echo " {{Param.RezPackages}}"
# Create the environment
/usr/local/bin/deadline-rez init \
-d "{{Session.WorkingDirectory}}" \
{{Param.RezPackages}}
# Capture the environment's vars
{{Env.File.InitialVars}}
. /usr/local/bin/deadline-rez activate \
-d "{{Session.WorkingDirectory}}"
{{Env.File.CaptureVars}}
else
echo "No Rez Packages, skipping environment creation."
fi
- name: Exit
filename: rez-exit.sh
type: TEXT
runnable: true
data: |
#!/bin/env bash
set -euo pipefail
if [ ! -z "{{Param.RezPackages}}" ]; then
echo "Rez Package List:"
echo " {{Param.RezPackages}}"
/usr/local/bin/deadline-rez destroy \
-d "{{ Session.WorkingDirectory }}"
else
echo "No Rez Packages, skipping environment teardown."
fi
- name: InitialVars
filename: initial-vars.sh
type: TEXT
runnable: true
data: |
#!/usr/bin/env python3
import os, json
envfile = "{{Session.WorkingDirectory}}/.envInitial"
with open(envfile, "w", encoding="utf8") as f:
json.dump(dict(os.environ), f)
- name: CaptureVars
filename: capture-vars.sh
type: TEXT
runnable: true
data: |
#!/usr/bin/env python3
import os, json, sys
envfile = "{{Session.WorkingDirectory}}/.envInitial"
if os.path.isfile(envfile):
with open(envfile, "r", encoding="utf8") as f:
before = json.load(f)
else:
print("No initial environment found, must run Env.File.CaptureVars script first")
sys.exit(1)
after = dict(os.environ)
put = {k: v for k, v in after.items() if v != before.get(k)}
delete = {k for k in before if k not in after}
for k, v in put.items():
print(f"updating {k}={v}")
print(f"openjobio_env: {k}={v}")
for k in delete:
print(f"openjobio_unset_env: {k}")
steps:
- name: layerDefaultFrames
parameterSpace:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ parameters:
control: LINE_EDIT
label: Rez Packages
groupLabel: Software Environment
description: A space-separated list of Rez packages to install
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
Expand Down Expand Up @@ -108,94 +109,6 @@ parameters:
allowedValues:
- 'true'
- 'false'
environments:
- name: Rez
description: Initializes and destroys the Rez environment for the run
script:
actions:
onEnter:
command: '{{Env.File.Enter}}'
onExit:
command: '{{Env.File.Exit}}'
embeddedFiles:
- name: Enter
filename: rez-enter.sh
type: TEXT
runnable: true
data: |
#!/bin/env bash
set -euo pipefail
if [ ! -z "{{Param.RezPackages}}" ]; then
echo "Rez Package List:"
echo " {{Param.RezPackages}}"
# Create the environment
/usr/local/bin/deadline-rez init \
-d "{{Session.WorkingDirectory}}" \
{{Param.RezPackages}}
# Capture the environment's vars
{{Env.File.InitialVars}}
. /usr/local/bin/deadline-rez activate \
-d "{{Session.WorkingDirectory}}"
{{Env.File.CaptureVars}}
else
echo "No Rez Packages, skipping environment creation."
fi
- name: Exit
filename: rez-exit.sh
type: TEXT
runnable: true
data: |
#!/bin/env bash
set -euo pipefail
if [ ! -z "{{Param.RezPackages}}" ]; then
echo "Rez Package List:"
echo " {{Param.RezPackages}}"
/usr/local/bin/deadline-rez destroy \
-d "{{ Session.WorkingDirectory }}"
else
echo "No Rez Packages, skipping environment teardown."
fi
- name: InitialVars
filename: initial-vars.sh
type: TEXT
runnable: true
data: |
#!/usr/bin/env python3
import os, json
envfile = "{{Session.WorkingDirectory}}/.envInitial"
with open(envfile, "w", encoding="utf8") as f:
json.dump(dict(os.environ), f)
- name: CaptureVars
filename: capture-vars.sh
type: TEXT
runnable: true
data: |
#!/usr/bin/env python3
import os, json, sys
envfile = "{{Session.WorkingDirectory}}/.envInitial"
if os.path.isfile(envfile):
with open(envfile, "r", encoding="utf8") as f:
before = json.load(f)
else:
print("No initial environment found, must run Env.File.CaptureVars script first")
sys.exit(1)
after = dict(os.environ)
put = {k: v for k, v in after.items() if v != before.get(k)}
delete = {k for k in before if k not in after}
for k, v in put.items():
print(f"updating {k}={v}")
print(f"openjobio_env: {k}={v}")
for k in delete:
print(f"openjobio_unset_env: {k}")
steps:
- name: layerTheFIrst
parameterSpace:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,4 @@ source = [

[tool.coverage.report]
show_missing = true
fail_under = 50
fail_under = 45
Loading

0 comments on commit a63b4ae

Please sign in to comment.