|
16 | 16 | import sys |
17 | 17 |
|
18 | 18 | import flux |
19 | | -from flux.util import AltField, UtilConfig, parse_fsd |
| 19 | +from flux.util import AltField, FilterActionSetUpdate, UtilConfig, parse_fsd |
20 | 20 |
|
21 | 21 |
|
22 | 22 | def print_enable_status(name, status): |
@@ -342,10 +342,22 @@ def list(args): |
342 | 342 | fmt = FluxQueueConfig("list").load().get_format_string(args.format) |
343 | 343 | formatter = flux.util.OutputFormat(fmt, headings=headings) |
344 | 344 |
|
| 345 | + # Build queue_config from args.queue, or config["queue"] if --queue |
| 346 | + # was unused: |
| 347 | + queue_config = {} |
| 348 | + if args.queue: |
| 349 | + for queue in args.queue: |
| 350 | + try: |
| 351 | + queue_config[queue] = config["queues"][queue] |
| 352 | + except KeyError: |
| 353 | + raise ValueError(f"No such queue: {queue}") |
| 354 | + elif config and "queues" in config: |
| 355 | + queue_config = config["queues"] |
| 356 | + |
345 | 357 | queues = [] |
346 | 358 | if config and "queues" in config: |
347 | | - status = fetch_all_queue_status(handle, config["queues"].keys()) |
348 | | - for key, value in config["queues"].items(): |
| 359 | + status = fetch_all_queue_status(handle, queue_config.keys()) |
| 360 | + for key, value in queue_config.items(): |
349 | 361 | queues.append( |
350 | 362 | QueueInfo(key, config, status[key]["enable"], status[key]["start"]) |
351 | 363 | ) |
@@ -511,6 +523,14 @@ def main(): |
511 | 523 | list_parser = subparsers.add_parser( |
512 | 524 | "list", formatter_class=flux.util.help_formatter() |
513 | 525 | ) |
| 526 | + list_parser.add_argument( |
| 527 | + "-q", |
| 528 | + "--queue", |
| 529 | + action=FilterActionSetUpdate, |
| 530 | + default=set(), |
| 531 | + metavar="QUEUE,...", |
| 532 | + help="Include only specified queues in output", |
| 533 | + ) |
514 | 534 | list_parser.add_argument( |
515 | 535 | "-o", |
516 | 536 | "--format", |
|
0 commit comments