Skip to content

Commit

Permalink
Allow pre-submit and post-submit callbacks
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Hughes <[email protected]>

This will allow passing a pre/post submit callback into the deadline
callback which would allow for customization and validation of scenes

Signed-off-by: Alex Hughes <[email protected]>
  • Loading branch information
Ahuge committed Apr 10, 2024
1 parent 4d40b8c commit cd5eef4
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/deadline/client/ui/dialogs/submit_job_to_deadline_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ def __init__(
auto_detected_attachments: AssetReferences,
attachments: AssetReferences,
on_create_job_bundle_callback,
on_pre_submit_callback=None,
on_post_submit_callback=None,
parent=None,
f=Qt.WindowFlags(),
show_host_requirements_tab=False,
Expand All @@ -93,6 +95,8 @@ def __init__(

self.job_settings_type = type(initial_job_settings)
self.on_create_job_bundle_callback = on_create_job_bundle_callback
self.on_pre_submit_callback = on_pre_submit_callback
self.on_post_submit_callback = on_post_submit_callback
self.create_job_response: Optional[Dict[str, Any]] = None
self.deadline_authentication_status = DeadlineAuthenticationStatus.getInstance()
self.show_host_requirements_tab = show_host_requirements_tab
Expand Down Expand Up @@ -400,6 +404,18 @@ def on_submit(self):

# Submit the job
try:
# Execute any PreSubmission function defined.
if self.on_pre_submit_callback:
self.on_pre_submit_callback(
self,
job_history_bundle_dir,
settings,
queue_parameters,
asset_references,
purpose=JobBundlePurpose.SUBMISSION
)


deadline = api.get_boto3_client("deadline")

job_history_bundle_dir = create_job_history_bundle_dir(
Expand Down Expand Up @@ -470,6 +486,17 @@ def on_submit(self):
deadline,
auto_accept=str2bool(get_setting("settings.auto_accept")),
)

# Execute any PostSubmission function defined.
if self.on_post_submit_callback:
self.on_post_submit_callback(
self,
job_history_bundle_dir,
settings,
queue_parameters,
asset_references,
purpose=JobBundlePurpose.SUBMISSION
)
except UserInitiatedCancel as uic:
logger.info("Canceling submission.")
QMessageBox.information(self, f"{settings.submitter_name} Job Submission", str(uic))
Expand Down

0 comments on commit cd5eef4

Please sign in to comment.