1010# SPDX-License-Identifier: LGPL-3.0
1111###############################################################
1212
13- import os
13+ import datetime
1414import errno
15- import sys
1615import json
17- import unittest
18- import datetime
19- import signal
2016import locale
17+ import os
2118import pathlib
19+ import signal
2220import subprocess
21+ import unittest
2322from glob import glob
2423
25- import yaml
26-
2724import flux
28- import flux .kvs
2925import flux .constants
26+ import flux .kvs
27+ import yaml
3028from flux import job
31- from flux .job import Jobspec , JobspecV1 , ffi , JobID , JobInfo
29+ from flux .job import JobInfo , Jobspec , JobspecV1 , ffi
3230from flux .job .stats import JobStats
33- from flux .future import Future
3431
3532
3633def __flux_size ():
@@ -49,7 +46,7 @@ def setUpClass(self):
4946 self .fh = flux .Flux ()
5047 self .use_ascii = False
5148 build_opts = subprocess .check_output (["flux" , "version" ]).decode ()
52- if locale .getlocale ()[1 ] != "UTF-8" or "ascii-only" in build_opts :
49+ if locale .getlocale ()[1 ] != "UTF-8" or "ascii-only" in build_opts :
5350 self .use_ascii = True
5451
5552 self .jobspec_dir = os .path .abspath (
@@ -90,7 +87,7 @@ def test_03_invalid_construction(self):
9087 ):
9188 with self .assertRaises (
9289 (ValueError , TypeError , yaml .scanner .ScannerError )
93- ) as cm :
90+ ):
9491 cls .from_yaml_file (invalid_jobspec_filepath )
9592
9693 def test_04_valid_construction (self ):
@@ -332,7 +329,7 @@ def cb(future, events):
332329 events .append (event .name )
333330
334331 future .then (cb , events )
335- rc = self .fh .reactor_run ()
332+ self .fh .reactor_run ()
336333
337334 # Last event should be "start"
338335 self .assertEqual (events [- 1 ], "start" )
@@ -688,32 +685,34 @@ def test_33_get_job(self):
688685 jobid = job .submit (self .fh , self .sleep_jobspec )
689686 meta = job .get_job (self .fh , jobid )
690687 self .assertIsInstance (meta , dict )
691- for key in ['id' ,
692- 'userid' ,
693- 'urgency' ,
694- 'priority' ,
695- 't_submit' ,
696- 't_depend' ,
697- 'state' ,
698- 'name' ,
699- 'cwd' ,
700- 'ntasks' ,
701- 'ncores' ,
702- 'duration' ,
703- 'nnodes' ,
704- 'result' ,
705- 'runtime' ,
706- 'returncode' ,
707- 'waitstatus' ,
708- 'nodelist' ,
709- 'exception' ]:
688+ for key in [
689+ "id" ,
690+ "userid" ,
691+ "urgency" ,
692+ "priority" ,
693+ "t_submit" ,
694+ "t_depend" ,
695+ "state" ,
696+ "name" ,
697+ "cwd" ,
698+ "ntasks" ,
699+ "ncores" ,
700+ "duration" ,
701+ "nnodes" ,
702+ "result" ,
703+ "runtime" ,
704+ "returncode" ,
705+ "waitstatus" ,
706+ "nodelist" ,
707+ "exception" ,
708+ ]:
710709 self .assertIn (key , meta )
711710
712- self .assertEqual (meta ['id' ], jobid )
713- self .assertEqual (meta [' name' ], "sleep" )
714- self .assertTrue (meta [' state' ] in ["SCHED" , "DEPEND" , "RUN" ])
715- self .assertEqual (meta [' ntasks' ], 1 )
716- self .assertEqual (meta [' ncores' ], 1 )
711+ self .assertEqual (meta ["id" ], jobid )
712+ self .assertEqual (meta [" name" ], "sleep" )
713+ self .assertTrue (meta [" state" ] in ["SCHED" , "DEPEND" , "RUN" ])
714+ self .assertEqual (meta [" ntasks" ], 1 )
715+ self .assertEqual (meta [" ncores" ], 1 )
717716
718717 # Test a job that does not exist
719718 meta = job .get_job (self .fh , 123456 )
@@ -727,11 +726,12 @@ def test_34_timeleft(self):
727726 jobid = job .submit (self .fh , spec , waitable = True )
728727 job .wait (self .fh , jobid = jobid )
729728 try :
730- dt = job .timeleft ()
731- dt = job .timeleft (self .fh )
729+ job .timeleft ()
730+ job .timeleft (self .fh )
732731 except OSError :
733732 pass
734733
734+
735735if __name__ == "__main__" :
736736 from subflux import rerun_under_flux
737737
0 commit comments