diff --git a/CHANGELOG.md b/CHANGELOG.md index 9db09488..15fb6c5a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ ## 1.15.0 [unreleased] +### Bug Fixes +1. [#193](https://github.com/influxdata/influxdb-client-python/pull/193): Fixed `tasks_api` to use proper function to get `Run` + ## 1.14.0 [2021-01-29] ### Features diff --git a/influxdb_client/client/tasks_api.py b/influxdb_client/client/tasks_api.py index b5477a61..61011714 100644 --- a/influxdb_client/client/tasks_api.py +++ b/influxdb_client/client/tasks_api.py @@ -165,7 +165,7 @@ def get_run(self, task_id: str, run_id: str) -> Run: :param run_id: run id :return: Run for specified task and run id """ - return self._service.get_tasks_id_runs(task_id=task_id, run_id=run_id) + return self._service.get_tasks_id_runs_id(task_id=task_id, run_id=run_id) def get_run_logs(self, task_id: str, run_id: str) -> List['LogEvent']: """Retrieve all logs for a run.""" diff --git a/tests/test_TasksApi.py b/tests/test_TasksApi.py index 0d3ca060..9c3283a2 100644 --- a/tests/test_TasksApi.py +++ b/tests/test_TasksApi.py @@ -381,3 +381,13 @@ def test_cancel_task_not_exist(self): assert self.tasks_api.cancel_run("020f755c3c082000", "020f755c3c082000") assert "failed to cancel run" in e.value.body assert "task not found" in e.value.body + + def test_get_run(self): + task = self.tasks_api.create_task_every(self.generate_name("it task"), TASK_FLUX, "1s", self.organization) + time.sleep(5) + run = self.tasks_api.get_runs(task_id=task.id)[0] + self.assertIsNotNone(run) + run_by_id = self.tasks_api.get_run(task.id, run.id) + self.assertIsNotNone(run_by_id) + self.assertEqual(run.id, run_by_id.id) +