From a9367c4cf27ba9d4a98538039e6fda004eed520a Mon Sep 17 00:00:00 2001 From: t-reents Date: Wed, 6 Mar 2024 09:12:36 +0100 Subject: [PATCH] Fix `submit_new_batch` when `verbose = True` The `submit_new_batch` method fails if `verbose` is set to `True`, as it refers to the `parent_group` to get the total number of submissions. When using the `BaseSubmissionController`, this attribute is not specified. To fix the `verbose` option for the `BaseSubmissionController` and `FromGroupSubmissionController`, the number of submissions is defined by the number of `all extras to `submit`. --- aiida_submission_controller/base.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/aiida_submission_controller/base.py b/aiida_submission_controller/base.py index 35b6b09..c68a285 100644 --- a/aiida_submission_controller/base.py +++ b/aiida_submission_controller/base.py @@ -183,7 +183,8 @@ def submit_new_batch(self, dry_run=False, sort=False, verbose=False, sleep=0): """Submit a new batch of calculations, ensuring less than self.max_concurrent active at the same time.""" CMDLINE_LOGGER.level = logging.INFO if verbose else logging.WARNING - extras_to_run = list(set(self.get_all_extras_to_submit()).difference(self._check_submitted_extras())) + all_extras = set(self.get_all_extras_to_submit()) + extras_to_run = list(all_extras.difference(self._check_submitted_extras())) if sort: extras_to_run = sorted(extras_to_run) @@ -204,7 +205,7 @@ def submit_new_batch(self, dry_run=False, sort=False, verbose=False, sleep=0): table.add_column("Available", justify="left", style="cyan", no_wrap=True) table.add_row( - str(self.parent_group.count()), + str(len(all_extras)), str(self.num_already_run), str(self.num_to_run), str(self.max_concurrent),