Skip to content

Commit

Permalink
fix: add default values for conda packages and channels (#110)
Browse files Browse the repository at this point in the history
* fix: add default values for conda packages and channels

Signed-off-by: Stephen Crowe <[email protected]>
  • Loading branch information
crowecawcaw authored Aug 29, 2024
1 parent 8b7862a commit d3f3adb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
16 changes: 12 additions & 4 deletions src/deadline/keyshot_submitter/Submit to AWS Deadline Cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,11 @@ def apply_sticky_settings(self, sticky_settings: dict):

for param in input_parameter_values:
if param.get("name") and param.get("value"):
# don't re-use KeyShotFile param if the render settings are copied from one file to another
if param["name"] != "KeyShotFile":
updated_parameter_values[param["name"]] = param["value"]
# Don't re-use KeyShotFile param if the render settings are copied from one file to another
# Don't preserve conda settings so the Keyshot version can be updated by updating the submitter
if param["name"] in ["KeyShotFile", "CondaPackages", "CondaChannels"]:
continue
updated_parameter_values[param["name"]] = param["value"]

self.parameter_values = [
{"name": parameter_name, "value": updated_parameter_values[parameter_name]}
Expand Down Expand Up @@ -446,7 +448,6 @@ def get_ksp_bundle_files(directory: str) -> Tuple[str, list[str]]:


def main(lux):

if lux.isSceneChanged():
result = lux.getInputDialog(
title="Unsaved changes",
Expand Down Expand Up @@ -506,6 +507,13 @@ def main(lux):
else:
settings.parameter_values.append({"name": "KeyShotFile", "value": scene_file})

# Add default values for Conda
major_version, minor_version = lux.getKeyShotDisplayVersion()
settings.parameter_values.append(
{"name": "CondaPackages", "value": f"keyshot={major_version}.* keyshot-openjd=0.1.*"}
)
settings.parameter_values.append({"name": "CondaChannels", "value": "deadline-cloud"})

job_template = construct_job_template(scene_name)
asset_references = construct_asset_references(settings)
parameter_values = construct_parameter_values(settings)
Expand Down
4 changes: 3 additions & 1 deletion test/keyshot_submitter/test_keyshot_submitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,10 @@ def test_settings_apply_sticky_settings():
settings.apply_sticky_settings(
{
"parameterValues": [
# input KeyShotFile from sticky settings should be ignored
# Some parameters should not be sticky
{"name": "KeyShotFile", "value": "scene_file_from_sticky_settings"},
{"name": "CondaPackages", "value": "keyshot=2023.* keyshot-openjd=0.0.1"},
{"name": "CondaChannels", "value": "conda-forge"},
],
"inputFilenames": ["test_filename_20"],
"inputDirectories": ["test_directory_21"],
Expand Down

0 comments on commit d3f3adb

Please sign in to comment.