Skip to content

Commit

Permalink
✨ Print a table with the status when submitting
Browse files Browse the repository at this point in the history
When using the `BaseSubmissionController.submit_new_batch()` method with
`verbose == True`, print a table with an overview of completed, active, ...
runs.
  • Loading branch information
mbercx committed Dec 15, 2023
1 parent d0694cd commit 2a4e67a
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions aiida_submission_controller/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
from aiida import engine, orm
from aiida.common import NotExistent
from pydantic import BaseModel, validator
from rich import print
from rich.console import Console
from rich.table import Table

CMDLINE_LOGGER = logging.getLogger("verdi")

Expand Down Expand Up @@ -171,6 +174,32 @@ def submit_new_batch(self, dry_run=False, sort=True, verbose=False):
if dry_run:
return {key: None for key in to_submit}

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 to_submit:
try:
Expand Down

0 comments on commit 2a4e67a

Please sign in to comment.