Skip to content

Commit

Permalink
✨ Add the order_by field to the FromGroupSubmissionController
Browse files Browse the repository at this point in the history
Allow the user to order the submission via providing `order_by` during
instantiation. This field is directly passed to the `order_by` method of the
`QueryBuilder` used to get all extras which have to be run.
  • Loading branch information
mbercx committed Dec 15, 2023
1 parent c28aaef commit 74c5e8a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions aiida_submission_controller/from_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ class FromGroupSubmissionController(BaseSubmissionController): # pylint: disabl
parent_group_label: str
"""Label of the parent group from which to construct the process inputs."""
filters: Optional[dict] = None
"""Filters applied to the query of the nodes in the parent group."""
order_by: Optional[dict] = None
"""Ordering applied to the query of the nodes in the parent group."""

_validate_group_exists = validator("parent_group_label", allow_reuse=True)(validate_group_exists)

Expand Down Expand Up @@ -63,6 +66,10 @@ def get_all_extras_to_submit(self):
tag="process",
with_group="group",
)

if self.order_by is not None:
qbuild.order_by(self.order_by)

results = qbuild.all()

# I return a set of results as required by the API
Expand Down

0 comments on commit 74c5e8a

Please sign in to comment.