File tree Expand file tree Collapse file tree 3 files changed +10
-1
lines changed
src/bindings/python/flux/job Expand file tree Collapse file tree 3 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -53,6 +53,8 @@ class JobID(int):
5353 """
5454
5555 def __new__ (cls , value ):
56+ if isinstance (value , JobID ):
57+ return cls (value .orig_str )
5658 if isinstance (value , int ):
5759 jobid = value
5860 else :
Original file line number Diff line number Diff line change 1313
1414import flux .constants
1515from flux .future import WaitAllFuture
16+ from flux .job import JobID
1617from flux .job .info import JobInfo
1718from flux .rpc import RPC
1819
@@ -211,7 +212,7 @@ def __init__(
211212 self .since = since
212213 self .name = name
213214 self .queue = queue
214- self .ids = ids
215+ self .ids = list ( map ( JobID , ids )) if ids else None
215216 self .errors = []
216217 for fname in filters :
217218 for x in fname .split ("," ):
Original file line number Diff line number Diff line change @@ -468,6 +468,12 @@ def test_24_jobid(self):
468468 # Ensure encode back to same type works
469469 self .assertEqual (getattr (jobid , key ), test [key ])
470470
471+ # JobID can also take a JobID
472+ jobid1 = job .JobID (1234 )
473+ jobid2 = job .JobID (jobid1 )
474+ self .assertEqual (jobid1 , jobid2 )
475+ self .assertEqual (jobid2 .orig , "1234" )
476+
471477 def test_25_job_list_attrs (self ):
472478 expected_attrs = [
473479 "userid" ,
You can’t perform that action at this time.
0 commit comments