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 ---------------------- diff --git a/flow/project.py b/flow/project.py index 8fdd92f72..8bd2970f6 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,10 @@ 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').""" - if ( - not args.func == self._main_exec - and args.job_id - and (args.filter or args.doc_filter) - ): + """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): 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 +4889,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) 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(