From d8b3b9458adb1ed32dda542d5a1a4c1e0bdaa3b1 Mon Sep 17 00:00:00 2001 From: Alex Hughes Date: Mon, 16 Dec 2024 09:23:38 -0800 Subject: [PATCH] Allow passing a predefined host_requirements to the SubmitJobToDeadlineDialog The dictionary passed to SubmitJobToDeadlineDialog will prepopulate the HostRequirementsWidget. This requires a new `set_requirements` method on the HostRequirementsWidget class Signed-off-by: Alex Hughes --- .../client/ui/dialogs/submit_job_to_deadline_dialog.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 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 b64c009e..a9d215b3 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 @@ -27,6 +27,7 @@ from deadline.job_attachments.models import JobAttachmentS3Settings from deadline.job_attachments.upload import S3AssetManager +from ..dataclasses import HostRequirements from ... import api from ..deadline_authentication_status import DeadlineAuthenticationStatus from .. import block_signals @@ -86,6 +87,7 @@ def __init__( parent=None, f=Qt.WindowFlags(), show_host_requirements_tab=False, + host_requirements: Optional[HostRequirements] = None, submitter_name: Optional[str] = None, ): # The Qt.Tool flag makes sure our widget stays in front of the main application window @@ -107,6 +109,7 @@ def __init__( initial_shared_parameter_values, auto_detected_attachments, attachments, + host_requirements, ) self.gui_update_counter: Any = None @@ -143,6 +146,7 @@ def _build_ui( initial_shared_parameter_values, auto_detected_attachments: AssetReferences, attachments: AssetReferences, + host_requirements: Optional[HostRequirements], ): self.lyt = QVBoxLayout(self) self.lyt.setContentsMargins(5, 5, 5, 5) @@ -158,7 +162,7 @@ def _build_ui( # Show host requirements only if requested by the constructor if self.show_host_requirements_tab: - self._build_host_requirements_tab() + self._build_host_requirements_tab(host_requirements) self.auth_status_box = DeadlineAuthenticationStatusWidget(self) self.lyt.addWidget(self.auth_status_box) @@ -272,12 +276,14 @@ def _build_job_attachments_tab( self.job_attachments_tab.setWidget(self.job_attachments) self.job_attachments_tab.setWidgetResizable(True) - def _build_host_requirements_tab(self): + def _build_host_requirements_tab(self, host_requirements: Optional[HostRequirements]): self.host_requirements = HostRequirementsWidget() self.host_requirements_tab = QScrollArea() self.tabs.addTab(self.host_requirements_tab, "Host requirements") self.host_requirements_tab.setWidget(self.host_requirements) self.host_requirements_tab.setWidgetResizable(True) + if host_requirements: + self.host_requirements.set_requirements(host_requirements) def on_shared_job_parameter_changed(self, parameter: dict[str, Any]): """