8000 fix(tasks_api): fixed get_run to use proper function (#193) · Nobatek/influxdb-client-python@d396581 · GitHub
[go: up one dir, main page]

Skip to content

Commit d396581

Browse files
authored
fix(tasks_api): fixed get_run to use proper function (influxdata#193)
1 parent 38bf155 commit d396581

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
## 1.15.0 [unreleased]
22

3+
### Bug Fixes
4+
1. [#193](https://github.com/influxdata/influxdb-client-python/pull/193): Fixed `tasks_api` to use proper function to get `Run`
5+
36
## 1.14.0 [2021-01-29]
47

58
### Features

influxdb_client/client/tasks_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ def get_run(self, task_id: str, run_id: str) -> Run:
165165
:param run_id: run id
166166
:return: Run for specified task and run id
167167
"""
168-
return self._service.get_tasks_id_runs(task_id=task_id, run_id=run_id)
168+
return self._service.get_tasks_id_runs_id(task_id=task_id, run_id=run_id)
169169

170170
def get_run_logs(self, task_id: str, run_id: str) -> List['LogEvent']:
171171
"""Retrieve all logs for a run."""

tests/test_TasksApi.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,3 +381,13 @@ def test_cancel_task_not_exist(self):
381381
assert self.tasks_api.cancel_run("020f755c3c082000", "020f755c3c082000")
382382
assert "failed to cancel run" in e.value.body
383383
assert "task not found" in e.value.body
384+
385+
def test_get_run(self):
386+
task = self.tasks_api.create_task_every(self.generate_name("it task"), TASK_FLUX, "1s", self.organization)
387+
time.sleep(5)
388+
run = self.tasks_api.get_runs(task_id=task.id)[0]
389+
self.assertIsNotNone(run)
390+
run_by_id = self.tasks_api.get_run(task.id, run.id)
391+
self.assertIsNotNone(run_by_id)
392+
self.assertEqual(run.id, run_by_id.id)
393+

0 commit comments

Comments
 (0)
0