Skip to content

Commit

Permalink
Merge pull request #335 from sirosen/search-get-task
Browse files Browse the repository at this point in the history
Add SearchClient.get_task
  • Loading branch information
Dave Shifflett authored Dec 13, 2018
2 parents 2ab2a44 + e131789 commit e8c7343
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions globus_sdk/search/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class SearchClient(BaseClient):
* :py:meth:`.delete_entry`
* :py:meth:`.get_query_template`
* :py:meth:`.get_query_template_list`
* :py:meth:`.get_task`
"""
# disallow basic auth
allowed_authorizer_types = [
Expand Down Expand Up @@ -521,3 +522,23 @@ def get_query_template_list(self, index_id):
self.logger.info("SearchClient.get_query_template_list({})".format(index_id))
path = self.qjoin_path("v1/index", index_id, "query_template")
return self.get(path)

#
# Task Management
#

def get_task(self, task_id, **params):
"""
``GET /v1/index/<task_id>``
**Examples**
>>> sc = globus_sdk.SearchClient(...)
>>> task = sc.get_task(task_id)
>>> assert task['index_id'] == known_index_id
>>> print(task["task_id"] + " | " + task['state'])
"""
task_id = safe_stringify(task_id)
self.logger.info("SearchClient.get_task({})".format(task_id))
path = self.qjoin_path("v1/task", task_id)
return self.get(path, params=params)

0 comments on commit e8c7343

Please sign in to comment.