Skip to content

Commit

Permalink
Allow passing a predefined host_requirements to the SubmitJobToDeadli…
Browse files Browse the repository at this point in the history
…neDialog

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 <[email protected]>
  • Loading branch information
Ahuge committed Dec 20, 2024
1 parent c2bf12f commit d8b3b94
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/deadline/client/ui/dialogs/submit_job_to_deadline_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -107,6 +109,7 @@ def __init__(
initial_shared_parameter_values,
auto_detected_attachments,
attachments,
host_requirements,
)

self.gui_update_counter: Any = None
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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]):
"""
Expand Down

0 comments on commit d8b3b94

Please sign in to comment.