Skip to content

Commit 819a73e

Browse files
committed
remove no-wait option
1 parent c73d115 commit 819a73e

1 file changed

Lines changed: 8 additions & 14 deletions

File tree

batchtools/br.py

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class CreateJobCommandArgs(argparse.Namespace):
3737
name: str = "job"
3838
job_id: str = uuid.uuid5(uuid.NAMESPACE_OID, f"{os.getpid()}-{time.time()}").hex
3939
job_delete: bool = True
40-
wait: bool = True
40+
# no more wait flag exposed to users; br always waits for completion
4141
timeout: int = 60 * 15 * 4
4242
max_sec: int = 60 * 15
4343
gpu_numreq: int = 1
@@ -80,12 +80,7 @@ def build_parser(cls, subparsers: SubParserFactory):
8080
default=CreateJobCommandArgs.job_delete,
8181
help="Delete job on completion",
8282
)
83-
p.add_argument(
84-
"--wait",
85-
action=argparse.BooleanOptionalAction,
86-
default=CreateJobCommandArgs.wait,
87-
help="Wait for job completion",
88-
)
83+
# removed --wait / --no-wait flag: br always waits for completion now
8984
p.add_argument(
9085
"--timeout",
9186
default=CreateJobCommandArgs.timeout,
@@ -185,10 +180,10 @@ def run(args: argparse.Namespace):
185180
queue_wait = None
186181
total_wall = None
187182

188-
if args.wait:
189-
result_phase, run_elapsed, queue_wait, total_wall = log_job_output(
190-
job_name=job_name, wait=True, timeout=args.timeout
191-
)
183+
# always wait for the job to complete
184+
result_phase, run_elapsed, queue_wait, total_wall = log_job_output(
185+
job_name=job_name, wait=True, timeout=args.timeout
186+
)
192187

193188
if (
194189
run_elapsed is not None
@@ -229,12 +224,12 @@ def run(args: argparse.Namespace):
229224
except oc.OpenShiftPythonException as e:
230225
sys.exit(f"Error occurred while creating job: {e}")
231226

232-
if args.job_delete and args.wait:
227+
if args.job_delete:
233228
print(f"RUNDIR: jobs/{job_name}")
234229
oc_delete("job", job_name)
235230
else:
236231
print(
237-
f"User specified not to wait, or not to delete, so {job_name} must be deleted by user.\n"
232+
f"User specified not to delete, so {job_name} must be deleted by user.\n"
238233
f"You can do this by running:\n"
239234
f" batchtools bd {job_name} OR\n"
240235
f" oc delete job {job_name}"
@@ -306,7 +301,6 @@ def log_job_output(
306301
total_wall = time.monotonic() - start_poll # fallback
307302
run_elapsed = total_wall - (queue_wait or 0.0)
308303
else:
309-
# Never reached Running; keep convention for failures:
310304
run_elapsed = 0.0 if result_phase == "failed" else None
311305
if total_wall is None:
312306
total_wall = 0.0

0 commit comments

Comments
 (0)