diff --git a/apiserver/bll/workers/__init__.py b/apiserver/bll/workers/__init__.py index 9b37a44..dd1dbd7 100644 --- a/apiserver/bll/workers/__init__.py +++ b/apiserver/bll/workers/__init__.py @@ -143,7 +143,7 @@ class WorkerBLL: self._log_stats_to_es( company_id=company_id, company_name=entry.company.name, - worker=report.worker, + worker=entry.key, timestamp=report.timestamp, task=report.task, machine_stats=report.machine_stats, diff --git a/apiserver/tests/automated/test_workers.py b/apiserver/tests/automated/test_workers.py index 7735d5e..703ee53 100644 --- a/apiserver/tests/automated/test_workers.py +++ b/apiserver/tests/automated/test_workers.py @@ -79,7 +79,8 @@ class TestWorkersService(TestService): self.api.workers.status_report(**data) time.sleep(1) - return workers + res = self.api.workers.get_all(last_seen=100) + return [w.key for w in res.workers] def _create_running_task(self, task_name): task_input = dict( @@ -109,7 +110,8 @@ class TestWorkersService(TestService): def test_get_stats(self): workers = self._simulate_workers() - to_date = utc_now_tz_aware() + + to_date = utc_now_tz_aware() + timedelta(seconds=10) from_date = to_date - timedelta(days=1) # no variants @@ -195,8 +197,8 @@ class TestWorkersService(TestService): self._simulate_workers() - to_date = utc_now_tz_aware() - from_date = to_date - timedelta(minutes=10) + to_date = utc_now_tz_aware() + timedelta(seconds=10) + from_date = to_date - timedelta(minutes=1) # no variants res = self.api.workers.get_activity_report(