From 74c5e8a0405919b71daa78a19e3e216b432e8f20 Mon Sep 17 00:00:00 2001 From: Marnik Bercx Date: Fri, 15 Dec 2023 22:48:18 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Add=20the=20`order=5Fby`=20field=20?= =?UTF-8?q?to=20the=20`FromGroupSubmissionController`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- aiida_submission_controller/from_group.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/aiida_submission_controller/from_group.py b/aiida_submission_controller/from_group.py index 3d3026a..b7a9908 100644 --- a/aiida_submission_controller/from_group.py +++ b/aiida_submission_controller/from_group.py @@ -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) @@ -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