Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add Submitter Callback functions #132

Open
wants to merge 6 commits into
base: mainline
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 53 additions & 1 deletion src/deadline/nuke_submitter/deadline_submitter_for_nuke.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
from .ui.components.scene_settings_tab import SceneSettingsWidget
from deadline.client.job_bundle.submission import AssetReferences
from deadline.client.exceptions import DeadlineOperationError
from deadline.client.util import ui_callback, post_submit_callback, create_job_bundle_callback

g_submitter_dialog = None

Expand Down Expand Up @@ -323,6 +324,57 @@ def on_create_job_bundle_callback(
nuke_version = nuke.env["NukeVersionMajor"]
adaptor_version = ".".join(str(v) for v in adaptor_version_tuple[:2])

callback_kwargs = {
"on_create_job_bundle_callback": on_create_job_bundle_callback
}
if os.path.exists(os.environ.get("DEADLINE_NUKE_CREATE_JOB_BUNDLE_CALLBACK", "")):
try:
on_create_job_bundle_callback = create_job_bundle_callback.load_create_job_bundle_callback(
module_path=os.environ.get("DEADLINE_NUKE_CREATE_JOB_BUNDLE_CALLBACK")
)
except Exception:
import traceback
raise DeadlineOperationError(
"Error while loading on_create_job_bundle_callback at {path}. {trace}".format(
path=os.environ.get("DEADLINE_NUKE_CREATE_JOB_BUNDLE_CALLBACK"),
trace=traceback.format_exc()
)
)

callback_kwargs["on_create_job_bundle_callback"] = on_create_job_bundle_callback

if os.path.exists(os.environ.get("DEADLINE_NUKE_UI_CALLBACK", "")):
try:
on_ui_callback = ui_callback.load_ui_callback(
module_path=os.environ.get("DEADLINE_NUKE_UI_CALLBACK")
)
except Exception:
import traceback
raise DeadlineOperationError(
"Error while loading on_pre_submit_callback at {path}. {trace}".format(
path=os.environ.get("DEADLINE_NUKE_UI_CALLBACK"),
trace=traceback.format_exc()
)
)

callback_kwargs["on_ui_callback"] = on_ui_callback

if os.path.exists(os.environ.get("DEADLINE_NUKE_POST_SUBMIT_CALLBACK", "")):
try:
on_post_submit_callback = post_submit_callback.load_post_submit_callback(
module_path=os.environ.get("DEADLINE_NUKE_POST_SUBMIT_CALLBACK"),
)
except Exception:
import traceback
raise DeadlineOperationError(
"Error while loading on_post_submit_callback at {path}. {trace}".format(
path=os.environ.get("DEADLINE_NUKE_POST_SUBMIT_CALLBACK"),
trace=traceback.format_exc()
)
)
callback_kwargs["on_post_submit_callback"] = on_post_submit_callback


# Need Nuke and the Nuke OpenJD application interface adaptor
rez_packages = f"nuke-{nuke_version} deadline_cloud_for_nuke"
conda_packages = f"nuke={nuke_version}.* nuke-openjd={adaptor_version}.*"
Expand All @@ -336,10 +388,10 @@ def on_create_job_bundle_callback(
},
auto_detected_attachments=auto_detected_attachments,
attachments=attachments,
on_create_job_bundle_callback=on_create_job_bundle_callback,
parent=parent,
f=f,
show_host_requirements_tab=True,
**callback_kwargs,
)
else:
g_submitter_dialog.refresh(
Expand Down