Skip to content

Commit cc53a52

Browse files
committed
flux-mini: change default units of --time-limit to minutes
Problem: The -t, --time-limit=FSD option of flux-mini is in FSD, which defaults to seconds when no units are explicitly supplied, but traditional resource managers with similar options default to minutes and this has been confusing first-time users. Change the interpretation of only the --time-limit option to default to minutes when no units are supplied. Fixes #4552
1 parent 0b10a63 commit cc53a52

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/cmd/flux-mini.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -461,8 +461,9 @@ def create_parser(exclude_io=False):
461461
"-t",
462462
"--time-limit",
463463
type=str,
464-
metavar="FSD",
465-
help="Time limit in Flux standard duration, e.g. 2d, 1.5h",
464+
metavar="MIN|FSD",
465+
help="Time limit in minutes when no units provided, otherwise "
466+
+ "in Flux standard duration, e.g. 30s, 2d, 1.5h",
466467
)
467468
parser.add_argument(
468469
"--urgency",
@@ -614,6 +615,13 @@ def jobspec_create(self, args):
614615
list_split(args.requires),
615616
)
616617
if args.time_limit is not None:
618+
# With no units, time_limit is in minutes, but jobspec.duration
619+
# takes seconds or FSD by default, so convert here if necessary.
620+
try:
621+
limit = float(args.time_limit)
622+
args.time_limit = limit * 60
623+
except ValueError:
624+
pass
617625
jobspec.duration = args.time_limit
618626

619627
if args.job_name is not None:

0 commit comments

Comments
 (0)