Skip to content

Commit 823417f

Browse files
authored
Merge pull request #6195 from grondo/cli-bank
add `-B, --bank=` option to submission commands
2 parents 58becf5 + 5d52d9f commit 823417f

File tree

4 files changed

+29
-2
lines changed

4 files changed

+29
-2
lines changed

doc/man1/common/job-param-additional.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,15 @@
66
option is ignored, though :man1:`flux-jobs` may display the queue
77
name in its rendering of the ``{queue}`` attribute.
88

9+
.. option:: -B, --bank=NAME
10+
11+
Set the bank name for this job to ``NAME``. This option is equivalent
12+
to `--setattr=bank=NAME`, and results in the ``bank`` attribute being
13+
set to ``NAME`` in the submitted jobspec. However, besides the bank
14+
name appearing in job listing output, this option may have no effect
15+
if no plugin or package that supports it (such as flux-accounting)
16+
is installed and configured.
17+
918
.. option:: -t, --time-limit=MINUTES|FSD
1019

1120
Set a time limit for the job in either minutes or Flux standard duration

etc/completions/flux.pre

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,7 @@ _flux_submit_commands()
375375

376376
local COMMON_OPTIONS="\
377377
-q --queue= \
378+
-B --bank= \
378379
-t --time-limit= \
379380
-o --setopt= \
380381
--setattr= \

src/bindings/python/flux/cli/base.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,7 @@ class Xcmd:
505505
# the string representation of an Xcmd object.
506506
mutable_args = {
507507
"queue": "-q",
508+
"bank": "-B",
508509
"ntasks": "-n",
509510
"nodes": "-N",
510511
"cores_per_task": "-c",
@@ -757,6 +758,13 @@ def create_parser(
757758
description=description,
758759
formatter_class=flux.util.help_formatter(),
759760
)
761+
parser.add_argument(
762+
"-B",
763+
"--bank",
764+
type=str,
765+
metavar="BANK",
766+
help="Submit a job to a specific named bank",
767+
)
760768
parser.add_argument(
761769
"-q",
762770
"--queue",
@@ -1042,6 +1050,9 @@ def jobspec_create(self, args):
10421050
if args.queue is not None:
10431051
jobspec.setattr("system.queue", args.queue)
10441052

1053+
if args.bank is not None:
1054+
jobspec.setattr("system.bank", args.bank)
1055+
10451056
if args.setattr is not None:
10461057
for keyval in args.setattr:
10471058
key, val = parse_jobspec_keyval("--setattr", keyval)
@@ -1425,7 +1436,6 @@ def _progress_check(self, args):
14251436
args.progress = None
14261437

14271438
def watcher_start(self, args):
1428-
14291439
if not self.watcher:
14301440
# Need to open self.flux_handle if it isn't already in order
14311441
# to start the watcher

t/t2710-python-cli-submit.t

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,14 @@ test_expect_success 'flux submit --queue works' '
9494
test_expect_success 'flux submit --queue works' '
9595
flux submit --env=-* --dry-run -q debug hostname >queue2.out && grep -i "debug" queue2.out
9696
'
97-
97+
test_expect_success 'flux submit --bank works' '
98+
flux submit --env=-* --dry-run --bank=mybank hostname >bank.out &&
99+
grep -i "mybank" bank.out
100+
'
101+
test_expect_success 'flux submit -B works' '
102+
flux submit --env=-* --dry-run -B mybank2 hostname >bank2.out &&
103+
grep -i "mybank2" bank2.out
104+
'
98105
test_expect_success 'flux submit --setattr works' '
99106
flux submit --env=-* --dry-run \
100107
--setattr user.meep=false \

0 commit comments

Comments
 (0)