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

@ -3798,7 +3798,6 @@ class Worker(ServiceCommandSection):
except:
pass
agent_install_bash_script = []
if os.environ.get('FORCE_LOCAL_CLEARML_AGENT_WHEEL'):
local_wheel = os.path.expanduser(os.environ.get('FORCE_LOCAL_CLEARML_AGENT_WHEEL'))
docker_wheel = '/tmp/{}'.format(basename(local_wheel))
@ -3839,9 +3838,6 @@ class Worker(ServiceCommandSection):
if preprocess_bash_script:
bash_script = preprocess_bash_script + bash_script
if agent_install_bash_script:
bash_script += agent_install_bash_script
docker_bash_script = " ; ".join([line for line in bash_script if line]) \
if not isinstance(bash_script, str) else bash_script

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))