Skip to content

Commit fcd7a06

Browse files
grondogarlick
authored andcommitted
python: add queue property to Jobspec
Problem: The jobspec system.queue attribute is as important as duration, cwd, and other jobspec attributes, but the queue is not currently treated as a special property of jobspec. Add jobspec.queue setter and getter to match other standard Jobspec class properties.
1 parent 09259e0 commit fcd7a06

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/bindings/python/flux/job/Jobspec.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,25 @@ def duration(self, duration):
371371
raise ValueError("duration must be a normal, finite value")
372372
self.setattr("system.duration", time)
373373

374+
@property
375+
def queue(self):
376+
"""
377+
Target queue of job submission
378+
"""
379+
try:
380+
return self.jobspec["attributes"]["system"]["queue"]
381+
except KeyError:
382+
return None
383+
384+
@queue.setter
385+
def queue(self, queue):
386+
"""
387+
Set target submission queue
388+
"""
389+
if not isinstance(queue, str):
390+
raise TypeError("queue must be a string")
391+
self.setattr("system.queue", queue)
392+
374393
@property
375394
def cwd(self):
376395
"""

0 commit comments

Comments
 (0)