Fix sending task logs fails when agent is not running in the same tenant

This commit is contained in:
allegroai
2022-12-05 11:19:14 +02:00
parent 1d5c118b70
commit 6e7fb5f331
2 changed files with 10 additions and 12 deletions

View File

@@ -816,14 +816,6 @@ class K8sIntegration(Worker):
except (KeyError, TypeError, AttributeError):
print("No tasks in queue {}".format(queue))
continue
events_service.send_log_events(
self.worker_id,
task_id=task_id,
lines="task {} pulled from {} by worker {}".format(
task_id, queue, self.worker_id
),
level="INFO",
)
task_session = None
if self._impersonate_as_task_owner:
@@ -843,6 +835,16 @@ class K8sIntegration(Worker):
)
continue
events_service.send_log_events(
self.worker_id,
task_id=task_id,
lines="task {} pulled from {} by worker {}".format(
task_id, queue, self.worker_id
),
level="INFO",
session=task_session,
)
self.report_monitor(ResourceMonitor.StatusReport(queues=queues, queue=queue, task=task_id))
self.run_one_task(queue, task_id, worker_params, task_session)
self.report_monitor(ResourceMonitor.StatusReport(queues=self.queues))