From 012ae847d1433493fb210e0c19a1fe64e38eb142 Mon Sep 17 00:00:00 2001 From: Alex Hughes Date: Wed, 17 Apr 2024 09:33:45 -0700 Subject: [PATCH] Move on_pre_submit_callback to optionally include requirements Signed-off-by: Automatic Software Release Bot --- .../dialogs/submit_job_to_deadline_dialog.py | 41 ++++++++++++------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/src/deadline/client/ui/dialogs/submit_job_to_deadline_dialog.py b/src/deadline/client/ui/dialogs/submit_job_to_deadline_dialog.py index c561b725f..fe2115f6e 100644 --- a/src/deadline/client/ui/dialogs/submit_job_to_deadline_dialog.py +++ b/src/deadline/client/ui/dialogs/submit_job_to_deadline_dialog.py @@ -68,10 +68,10 @@ class SubmitJobToDeadlineDialog(QDialog): on_create_job_bundle_callback: A function to call when the dialog needs to create a Job Bundle. It is called with arguments (widget, job_bundle_dir, settings, queue_parameters, asset_references) on_pre_submit_callback: A function to call just prior to the dialog submitting the Job Bundle. It is - called with arguments (widget, job_bundle_dir, settings, queue_parameters, asset_references). + called with arguments (widget, job_bundle_dir, settings, queue_parameters, asset_references, requirements). This callback can be used to validate or modify a scene file before submitting. - on_post_submit_callback: A function to call just after the dialog has submitted the Job Bundle. It - is called with arguments (widget, job_bundle_dir, settings, queue_parameters, asset_references). + on_post_submit_callback: A function to call just after the dialog has submitted the Job Bundle. It is + called with arguments (widget, job_bundle_dir, settings, queue_parameters, asset_references, requirements). This callback may may be required if the `on_pre_submit_callback` modifies the scene file to prepare it for submission and work needs to be done to modify the scene back to a working state. parent: parent of the widget @@ -411,18 +411,6 @@ 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( @@ -431,6 +419,18 @@ def on_submit(self): if self.show_host_requirements_tab: requirements = self.host_requirements.get_requirements() + # 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, + requirements, + purpose=JobBundlePurpose.SUBMISSION + ) + self.on_create_job_bundle_callback( self, job_history_bundle_dir, @@ -441,6 +441,16 @@ def on_submit(self): purpose=JobBundlePurpose.SUBMISSION, ) else: + # 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 + ) # Maintaining backward compatibility for submitters that do not support host_requirements yet self.on_create_job_bundle_callback( self, @@ -502,6 +512,7 @@ def on_submit(self): settings, queue_parameters, asset_references, + requirements, purpose=JobBundlePurpose.SUBMISSION ) except UserInitiatedCancel as uic: