File tree Expand file tree Collapse file tree 4 files changed +9
-6
lines changed
Expand file tree Collapse file tree 4 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -236,10 +236,11 @@ async def logs(
236236 log_file = self .get_log_file (run_name , job_id )
237237 except FileNotFoundError :
238238 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 )
242242 )
243+ logger .error (msg )
243244 else :
244245 if locate :
245246 print (log_file )
Original file line number Diff line number Diff line change 11class 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]):
4040 if len (dirs ) == 0 :
4141 raise FileNotFoundError
4242 elif len (dirs ) > 1 :
43- raise TooManyJobsFound
43+ raise TooManyJobsFound ( dirs )
4444 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):
4747
4848 def test_get_job_id_throws_toomanyjobsfound_on_more_than_one_job (self ):
4949 jobs = ["1" , "2" ]
50- with pytest .raises (TooManyJobsFound ):
50+ with pytest .raises (TooManyJobsFound ) as exc :
5151 get_job_id (jobs )
52+ assert exc .value .dirs == jobs
5253
5354 async def test_logs_command_display_log_file_of_latest_run (self ):
5455 with tempfile .TemporaryDirectory () as data_dir :
You can’t perform that action at this time.
0 commit comments