From 23f9bf4e076d8a258c6a235383658a69babeda8c Mon Sep 17 00:00:00 2001 From: Corwin Kerr Date: Fri, 14 Apr 2023 14:48:24 -0400 Subject: [PATCH 1/4] First pass at fix --- flow/project.py | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/flow/project.py b/flow/project.py index 8fdd92f72..cf0b400e9 100644 --- a/flow/project.py +++ b/flow/project.py @@ -4223,12 +4223,6 @@ def _add_job_selection_args(cls, parser): nargs="+", help="Only select jobs that match the given state point filter.", ) - parser.add_argument( - "--doc-filter", - type=str, - nargs="+", - help="Only select jobs that match the given document filter.", - ) @classmethod def _add_operation_selection_arg_group(cls, parser): @@ -4757,7 +4751,6 @@ def _main_status(self, args): "debug", "job_id", "filter", - "doc_filter", ] } if args.pop("full"): @@ -4876,14 +4869,14 @@ def operation_function(job): operation_function(*aggregate) def _select_jobs_from_args(self, args): - """Select jobs with the given command line arguments ('-j/-f/--doc-filter/--job-id').""" + """Select jobs with the given command line arguments ('-j/-f/--job-id').""" if ( not args.func == self._main_exec and args.job_id - and (args.filter or args.doc_filter) + and (args.filter) ): raise ValueError( - "Cannot provide both -j/--job-id and -f/--filter or --doc-filter in combination." + "Cannot provide both -j/--job-id and -f/--filter in combination." ) if args.job_id: @@ -4900,12 +4893,11 @@ def _select_jobs_from_args(self, args): elif args.func == self._main_exec: # exec command does not support filters, so we must exit early. return _AggregateStoresCursor(self) - elif args.filter or args.doc_filter: - # filter or doc_filter provided. Filters can only be used to select + elif args.filter: + # filter, including doc_filter provided. Filters can only be used to select # single jobs and not aggregates of multiple jobs. filter_ = parse_filter_arg(args.filter) - doc_filter = parse_filter_arg(args.doc_filter) - return _JobAggregateCursor(self, filter_, doc_filter) + return _JobAggregateCursor(self, filter_) else: # Use all aggregates return _AggregateStoresCursor(self) From ad262071112704bdb86cd91c741a4a63afa36b79 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 14 Apr 2023 18:51:36 +0000 Subject: [PATCH 2/4] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- flow/project.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/flow/project.py b/flow/project.py index cf0b400e9..8bd2970f6 100644 --- a/flow/project.py +++ b/flow/project.py @@ -4870,11 +4870,7 @@ def operation_function(job): def _select_jobs_from_args(self, args): """Select jobs with the given command line arguments ('-j/-f/--job-id').""" - if ( - not args.func == self._main_exec - and args.job_id - and (args.filter) - ): + if not args.func == self._main_exec and args.job_id and (args.filter): raise ValueError( "Cannot provide both -j/--job-id and -f/--filter in combination." ) From 25142b905aa08f3b1f3775e8c1cc1a5ffa83adb8 Mon Sep 17 00:00:00 2001 From: Corwin Kerr Date: Fri, 14 Apr 2023 15:07:39 -0400 Subject: [PATCH 3/4] Add filter test --- tests/test_project.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/test_project.py b/tests/test_project.py index a8b99401d..7d0627329 100644 --- a/tests/test_project.py +++ b/tests/test_project.py @@ -1307,6 +1307,18 @@ def test_main_run(self): else: assert not job.isfile("world.txt") + def test_main_run_filter(self): + assert len(self.project) + for job in self.project: + assert not job.isfile("world.txt") + self.call_subcmd("run -o op1 -f b 2") + even_jobs = [job for job in self.project if job.sp.b == 2] + for job in self.project: + if job in even_jobs: + assert job.isfile("world.txt") + else: + assert not job.isfile("world.txt") + def test_main_run_invalid_op(self): assert len(self.project) run_output = self.call_subcmd( From c45c6edaabbfe8368c92f5c4ec0c0de938bdc31c Mon Sep 17 00:00:00 2001 From: Corwin Kerr Date: Fri, 14 Apr 2023 16:18:17 -0400 Subject: [PATCH 4/4] Update changelog --- changelog.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/changelog.txt b/changelog.txt index a002f4d5c..1657aefd3 100644 --- a/changelog.txt +++ b/changelog.txt @@ -8,6 +8,19 @@ The numbers in brackets denote the related GitHub issue and/or pull request. Version 0.25 ============ +[0.25.1] -- 2023-XX-XX +---------------------- + +Fixed ++++++ + +- Fix filter argument (#737, #738). + +Removed ++++++++ + +- ``--doc-filter`` argument (#738). + [0.25.0] -- 2023-03-30 ----------------------