From 9be4798dc6f3374619fdb5b8aa441234015648f1 Mon Sep 17 00:00:00 2001 From: Marnik Bercx Date: Mon, 11 Sep 2023 16:54:08 +0200 Subject: [PATCH] Developments not fully integrated yet 1. Allow user to specify unique keys upon instantiation. 2. Add `order_by` input which can be passed to the parent node query. 3. Verbose submission now has a formatted table. --- aiida_submission_controller/base.py | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/aiida_submission_controller/base.py b/aiida_submission_controller/base.py index 3a51bcb..e297de0 100644 --- a/aiida_submission_controller/base.py +++ b/aiida_submission_controller/base.py @@ -218,6 +218,32 @@ def submit_new_batch(self, dry_run=False, sort=False, verbose=False): else: print(f"[bold blue]Info:[/] 🚀 Submitting {number_to_submit} new workchains!") + if verbose: + table = Table(title="Status") + + table.add_column("Total", justify="left", style="cyan", no_wrap=True) + table.add_column("Finished", justify="left", style="cyan", no_wrap=True) + table.add_column("Left to run", justify="left", style="cyan", no_wrap=True) + table.add_column("Max active", justify="left", style="cyan", no_wrap=True) + table.add_column("Active", justify="left", style="cyan", no_wrap=True) + table.add_column("Available", justify="left", style="cyan", no_wrap=True) + + table.add_row( + str(self.parent_group.count()), + str(self.num_already_run), + str(self.num_to_run), + str(self.max_concurrent), + str(self.num_active_slots), + str(self.num_available_slots), + ) + console = Console() + console.print(table) + + if len(to_submit) == 0: + print("[bold blue]Info:[/] 😴 Nothing to submit.") + else: + print(f"[bold blue]Info:[/] 🚀 Submitting {len(to_submit)} new workchains!") + submitted = {} for workchain_extras in extras_to_run: @@ -231,7 +257,7 @@ def submit_new_batch(self, dry_run=False, sort=False, verbose=False): # Actually submit wc_node = engine.submit(builder) - except Exception as exc: + except (ValueError, TypeError, AttributeError) as exc: CMDLINE_LOGGER.error(f"Failed to submit work chain for extras <{workchain_extras}>: {exc}") else: CMDLINE_LOGGER.report(f"Submitted work chain <{wc_node}> for extras <{workchain_extras}>.")