Skip to content

Commit

Permalink
‼️ Prioritize the order_by approach to sorting submissions
Browse files Browse the repository at this point in the history
Currently the `order_by` field of the `FromGroupSubmissionController` does not
actually work as intented for default `submit_new_batch` calls, since it will
sort the `extras_to_run` again after the extras "to submit" are obtained.
Moreover, the `get_all_extras_to_submit` method of the
`FromGroupSubmissionController` would return the extras as a set, instead of the
list obtained by the ordered query.

Here we set the `sort` input argument of the `submit_new_batch()` method to
`False` by default. This is technically a backwards-incompatible change,
although any impact on users should be minor since it only changes the order
of submission.
  • Loading branch information
mbercx committed Dec 20, 2023
1 parent 8dcea88 commit 201cdac
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions aiida_submission_controller/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,14 +152,14 @@ def num_available_slots(self):
@property
def num_to_run(self):
"""Number of processes that still have to be submitted."""
return len(self.get_all_extras_to_submit().difference(self._check_submitted_extras()))
return len(set(self.get_all_extras_to_submit()).difference(self._check_submitted_extras()))

@property
def num_already_run(self):
"""Number of processes that have already been submitted (and might or might not have finished)."""
return len(self._check_submitted_extras())

def submit_new_batch(self, dry_run=False, sort=True, verbose=False):
def submit_new_batch(self, dry_run=False, sort=False, verbose=False):
"""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

Expand Down
2 changes: 1 addition & 1 deletion aiida_submission_controller/from_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,4 @@ def get_all_extras_to_submit(self):
results_set = set(results)

assert len(results) == len(results_set), "There are duplicate extras in the parent group"
return results_set
return results

0 comments on commit 201cdac

Please sign in to comment.