Skip to content

Commit 0262ff0

Browse files
Merge pull request #81 from nextmv-io/feature/eng-5850-add-ability-to-specify-priority-and-no-queuing-in-python-sdk
2 parents 310c5c5 + ce3419c commit 0262ff0

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

nextmv/nextmv/cloud/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
from .run import RunConfiguration as RunConfiguration
4646
from .run import RunInformation as RunInformation
4747
from .run import RunLog as RunLog
48+
from .run import RunQueueing as RunQueueing
4849
from .run import RunResult as RunResult
4950
from .run import RunType as RunType
5051
from .run import RunTypeConfiguration as RunTypeConfiguration

nextmv/nextmv/cloud/run.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,30 @@ class RunTypeConfiguration(BaseModel):
128128
"""ID of the reference for the run type."""
129129

130130

131+
class RunQueueing(BaseModel):
132+
"""Queueing configuration for a run."""
133+
134+
priority: Optional[int] = None
135+
"""
136+
Priority of the run in the queue. 1 is the highest priority, 10 is the
137+
lowest priority.
138+
"""
139+
disabled: Optional[bool] = None
140+
"""
141+
Whether the run should be queued, or not. If True, the run will not be
142+
queued. If False, the run will be queued.
143+
"""
144+
145+
def __post_init_post_parse__(self):
146+
"""Validations done after parsing the model."""
147+
148+
if self.priority is not None and (self.priority < 1 or self.priority > 10):
149+
raise ValueError("Priority must be between 1 and 10.")
150+
151+
if self.disabled is not None and self.disabled not in {True, False}:
152+
raise ValueError("Disabled must be a boolean value.")
153+
154+
131155
class RunConfiguration(BaseModel):
132156
"""Configuration for an app run."""
133157

@@ -139,6 +163,8 @@ class RunConfiguration(BaseModel):
139163
"""Run type configuration for the run."""
140164
secrets_collection_id: Optional[str] = None
141165
"""ID of the secrets collection to use for the run."""
166+
queuing: Optional[RunQueueing] = None
167+
"""Queueing configuration for the run."""
142168

143169

144170
class ExternalRunResult(BaseModel):

0 commit comments

Comments
 (0)