Fix worker Id is used instead of worker key when processing report

This commit is contained in:
allegroai 2022-07-08 17:48:17 +03:00
parent c18eb99d06
commit c28f478ea8
2 changed files with 7 additions and 5 deletions

View File

@ -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,

View File

@ -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(