-
Notifications
You must be signed in to change notification settings - Fork 314
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add task exclude filter #844
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -287,6 +287,19 @@ You can use ``--include-tasks`` to specify a comma-separated list of tasks that | |
* Execute only tasks of type ``search``: ``--include-tasks="type:search"`` | ||
* You can also mix and match: ``--include-tasks="index,type:search"`` | ||
|
||
``exclude-tasks`` | ||
~~~~~~~~~~~~~~~~~ | ||
|
||
Similarly to :ref:`include-tasks <clr_include_tasks>` when challenge consists of one or more tasks you might be interested in excluding a single operations but include the rest. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: when a challenge. |
||
|
||
You can use ``--exclude-tasks`` to specify a comma-separated list of tasks that you want to skip. Each item in the list defines either the name of a task or the operation type of a task. Only the tasks that did not match will be executed. | ||
|
||
**Examples**: | ||
|
||
* Do not execute any tasks with the name ``index`` and ``term``: ``--exclude-tasks="index,term"`` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion: Use "Skip" instead of "Do not execute"? |
||
* Do not execute any tasks of type ``search``: ``--exclude-tasks="type:search"`` | ||
* You can also mix and match: ``--exclude-tasks="index,type:search"`` | ||
|
||
``team-repository`` | ||
~~~~~~~~~~~~~~~~~~~ | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1256,11 +1256,11 @@ def test_sets_absolute_path(self, path_exists): | |
|
||
|
||
class TrackFilterTests(TestCase): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you please change the test case method names? They sometimes reference the term "included" which is outdated now. |
||
def test_create_filters_from_empty_included_tasks(self): | ||
def test_create_filters_from_empty_filtered_tasks(self): | ||
self.assertEqual(0, len(loader.filters_from_filtered_tasks(None))) | ||
self.assertEqual(0, len(loader.filters_from_filtered_tasks([]))) | ||
|
||
def test_create_filters_from_mixed_included_tasks(self): | ||
def test_create_filters_from_mixed_filtered_tasks(self): | ||
filters = loader.filters_from_filtered_tasks(["force-merge", "type:search"]) | ||
self.assertListEqual([track.TaskNameFilter("force-merge"), track.TaskOpTypeFilter("search")], filters) | ||
|
||
|
@@ -1272,7 +1272,7 @@ def test_rejects_invalid_syntax(self): | |
def test_rejects_unknown_filter_type(self): | ||
with self.assertRaises(exceptions.SystemSetupError) as ctx: | ||
loader.filters_from_filtered_tasks(["valid", "op-type:index"]) | ||
self.assertEqual("Invalid format for included tasks: [op-type:index]. Expected [type] but got [op-type].", ctx.exception.args[0]) | ||
self.assertEqual("Invalid format for filtered tasks: [op-type:index]. Expected [type] but got [op-type].", ctx.exception.args[0]) | ||
|
||
def test_filters_tasks(self): | ||
track_specification = { | ||
|
@@ -1428,12 +1428,12 @@ def test_filters_exclude_tasks(self): | |
full_track = reader("unittest", track_specification, "/mappings") | ||
self.assertEqual(4, len(full_track.challenges[0].schedule)) | ||
|
||
filtered = loader.filter_tasks(full_track, [track.TaskNameFilter("index-3")], exclude=True) | ||
filtered = loader.filter_tasks(full_track, [track.TaskNameFilter("index-3"), track.TaskOpTypeFilter("search")], exclude=True) | ||
|
||
schedule = filtered.challenges[0].schedule | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we exclude one of the parallel tasks then nothing in that group runs.. should I correct the behaviour for that or does it make sense like that? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think if we exclude a single task in a parallel element, only that single one should be excluded but all others should still be included. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I had another look and I meant something else than what is implemented at the moment. I have visualized the challenge
If we specify
but instead we get:
Can you please have another look? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fyi, I've created this output with a new There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Scratch that. As discussed offline, the operation type is |
||
self.assertEqual(3, len(schedule)) | ||
self.assertEqual("node-stats", schedule[0].name) | ||
self.assertEqual("match-all-serial", schedule[1].name) | ||
self.assertEqual(["index-1",'index-2'], [t.name for t in schedule[0].tasks]) | ||
self.assertEqual("node-stats", schedule[1].name) | ||
self.assertEqual("cluster-stats", schedule[2].name) | ||
|
||
class TrackSpecificationReaderTests(TestCase): | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: missing period.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to use double-backticks so it is
instead of