File tree 4 files changed +9
-6
lines changed
4 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -236,10 +236,11 @@ async def logs(
236
236
log_file = self .get_log_file (run_name , job_id )
237
237
except FileNotFoundError :
238
238
logger .error ("No log file found" )
239
- except TooManyJobsFound :
240
- logger . error (
241
- "Found too many jobs for target run. Please pick a job id with -j flag."
239
+ except TooManyJobsFound as e :
240
+ msg = "Found too many jobs: {jobs} for target run. Please pick a job id with -j flag." . format (
241
+ jobs = ", " . join ( e . jobs )
242
242
)
243
+ logger .error (msg )
243
244
else :
244
245
if locate :
245
246
print (log_file )
Original file line number Diff line number Diff line change 1
1
class TooManyJobsFound (Exception ):
2
- pass
2
+ def __init__ (self , jobs : list [str ]):
3
+ self .jobs = jobs
Original file line number Diff line number Diff line change @@ -40,5 +40,5 @@ def get_job_id(jobs: list[str]):
40
40
if len (dirs ) == 0 :
41
41
raise FileNotFoundError
42
42
elif len (dirs ) > 1 :
43
- raise TooManyJobsFound
43
+ raise TooManyJobsFound ( dirs )
44
44
return dirs [0 ]
Original file line number Diff line number Diff line change @@ -47,8 +47,9 @@ def test_get_job_id_throws_filenotfound_on_missing_job(self):
47
47
48
48
def test_get_job_id_throws_toomanyjobsfound_on_more_than_one_job (self ):
49
49
jobs = ["1" , "2" ]
50
- with pytest .raises (TooManyJobsFound ):
50
+ with pytest .raises (TooManyJobsFound ) as exc :
51
51
get_job_id (jobs )
52
+ assert exc .value .dirs == jobs
52
53
53
54
async def test_logs_command_display_log_file_of_latest_run (self ):
54
55
with tempfile .TemporaryDirectory () as data_dir :
You can’t perform that action at this time.
0 commit comments