77import sys
88import time
99import uuid
10+ import subprocess
1011
1112import openshift_client as oc
1213
1314from .basecommand import Command
1415from .basecommand import SubParserFactory
1516from .build_yaml import build_job_body
16- from .helpers import pretty_print
1717from .helpers import oc_delete
1818from .helpers import fmt
1919from .file_setup import prepare_context
@@ -175,9 +175,9 @@ def run(args: argparse.Namespace):
175175 getlist_path = getlist ,
176176 )
177177
178- print (f"Creating job { job_name } in { queue_name } ..." )
178+ # print(f"Creating job {job_name} in {queue_name}...")
179179 oc .create (job_body )
180- print (f"Job { job_name } created successfully." )
180+ # print(f"Job {job_name} created successfully.")
181181
182182 result_phase = "unknown"
183183 run_elapsed = None
@@ -229,6 +229,7 @@ def run(args: argparse.Namespace):
229229 sys .exit (f"Error occurred while creating job: { e } " )
230230
231231 if args .job_delete and args .wait :
232+ subprocess .run (["cat" , f"jobs/{ job_name } .log" ], check = True )
232233 print (f"RUNDIR: jobs/{ job_name } " )
233234 oc_delete ("job" , job_name )
234235 else :
@@ -257,7 +258,7 @@ def log_job_output(
257258 """
258259 pods = oc .selector ("pod" , labels = {"job-name" : job_name }).objects ()
259260 if not pods :
260- print (f"No pods found for job { job_name } " )
261+ # print(f"No pods found for job {job_name}")
261262 return ("unknown" , None , None , None )
262263
263264 pod = pods [0 ]
@@ -280,7 +281,7 @@ def log_job_output(
280281 if phase in ("Succeeded" , "Failed" ):
281282 result_phase = phase .lower ()
282283 total_wall = time .monotonic () - start_poll # submit -> terminal
283- print (f"Pod { pod_name } finished with phase={ phase } " )
284+ # print(f"Pod {pod_name} finished with phase={phase}")
284285 break
285286
286287 if timeout and (time .monotonic () - start_poll ) > timeout :
@@ -290,12 +291,12 @@ def log_job_output(
290291 oc_delete ("job" , job_name )
291292 total_wall = time .monotonic () - start_poll
292293 # timeout: no run duration (didn't finish), queue_wait may or may not be set
293- print_timing (queue_wait , None , total_wall )
294+ # print_timing(queue_wait, None, total_wall)
294295 return ("timeout" , None , queue_wait , total_wall )
295296
296297 time .sleep (2 )
297298
298- print (pretty_print (pod ))
299+ # print(pretty_print(pod))
299300
300301 # compute the runtime using the total time (total_wall)- time waiting in queue (queue_wait)
301302
@@ -312,18 +313,18 @@ def log_job_output(
312313 if total_wall is not None and queue_wait is None :
313314 queue_wait = total_wall
314315
315- print_timing (queue_wait , run_elapsed , total_wall )
316+ # print_timing(queue_wait, run_elapsed, total_wall)
316317 return (result_phase , run_elapsed , queue_wait , total_wall )
317318
318319
319- def print_timing (
320- queue_wait : Optional [float ],
321- run_elapsed : Optional [float ],
322- total_wall : Optional [float ],
323- ) -> None :
324- print (
325- "TIMING: "
326- f"queue_wait={ fmt (queue_wait )} , "
327- f"run_duration={ fmt (run_elapsed )} , "
328- f"total_wall={ fmt (total_wall )} "
329- )
320+ # def print_timing(
321+ # queue_wait: Optional[float],
322+ # run_elapsed: Optional[float],
323+ # total_wall: Optional[float],
324+ # ) -> None:
325+ # print(
326+ # "TIMING: "
327+ # f"queue_wait={fmt(queue_wait)}, "
328+ # f"run_duration={fmt(run_elapsed)}, "
329+ # f"total_wall={fmt(total_wall)}"
330+ # )
0 commit comments