Skip to content

Update tasks API #659

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

Merged
merged 2 commits into from
Oct 26, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions elasticsearch/client/cat.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,8 +402,8 @@ def snapshots(self, repository, params=None):
return self.transport.perform_request('GET', _make_path('_cat',
'snapshots', repository), params=params)

@query_params('actions', 'detailed', 'format', 'h', 'help', 'node_id',
'parent_node', 'parent_task', 's', 'v')
@query_params('actions', 'detailed', 'format', 'h', 'help', 'nodes',
'parent_task_id', 's', 'v')
def tasks(self, params=None):
"""

Expand All @@ -415,12 +415,11 @@ def tasks(self, params=None):
:arg format: a short version of the Accept header, e.g. json, yaml
:arg h: Comma-separated list of column names to display
:arg help: Return help information, default False
:arg node_id: A comma-separated list of node IDs or names to limit the
:arg nodes: A comma-separated list of node IDs or names to limit the
returned information; use `_local` to return information from the
node you're connecting to, leave empty to get information from all
nodes
:arg parent_node: Return tasks with specified parent node.
:arg parent_task: Return tasks with specified parent task id. Set to -1
:arg parent_task_id: Return tasks with specified parent task id. Set to -1
to return all.
:arg s: Comma-separated list of column names or column aliases to sort
by
Expand Down
16 changes: 7 additions & 9 deletions elasticsearch/client/tasks.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from .utils import NamespacedClient, query_params, _make_path, SKIP_IN_PATH

class TasksClient(NamespacedClient):
@query_params('actions', 'detailed', 'group_by', 'node_id', 'parent_node',
'parent_task', 'wait_for_completion')
@query_params('actions', 'detailed', 'group_by', 'nodes',
'parent_task_id', 'wait_for_completion')
def list(self, params=None):
"""
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/tasks.html>`_
Expand All @@ -12,19 +12,18 @@ def list(self, params=None):
:arg detailed: Return detailed task information (default: false)
:arg group_by: Group tasks by nodes or parent/child relationships,
default 'nodes', valid choices are: 'nodes', 'parents'
:arg node_id: A comma-separated list of node IDs or names to limit the
:arg nodes: A comma-separated list of node IDs or names to limit the
returned information; use `_local` to return information from the
node you're connecting to, leave empty to get information from all
nodes
:arg parent_node: Return tasks with specified parent node.
:arg parent_task: Return tasks with specified parent task id
:arg parent_task_id: Return tasks with specified parent task id
(node_id:task_number). Set to -1 to return all.
:arg wait_for_completion: Wait for the matching tasks to complete
(default: false)
"""
return self.transport.perform_request('GET', '/_tasks', params=params)

@query_params('actions', 'node_id', 'parent_node', 'parent_task')
@query_params('actions', 'nodes', 'parent_task_id')
def cancel(self, task_id=None, params=None):
"""

Expand All @@ -34,12 +33,11 @@ def cancel(self, task_id=None, params=None):
(node_id:task_number)
:arg actions: A comma-separated list of actions that should be
cancelled. Leave empty to cancel all.
:arg node_id: A comma-separated list of node IDs or names to limit the
:arg nodes: A comma-separated list of node IDs or names to limit the
returned information; use `_local` to return information from the
node you're connecting to, leave empty to get information from all
nodes
:arg parent_node: Cancel tasks with specified parent node.
:arg parent_task: Cancel tasks with specified parent task id
:arg parent_task_id: Cancel tasks with specified parent task id
(node_id:task_number). Set to -1 to cancel all.
"""
return self.transport.perform_request('POST', _make_path('_tasks',
Expand Down