Fix runtime property overriding existing properties

This commit is contained in:
allegroai 2023-07-20 10:41:15 +03:00
parent 6b7ee12dc1
commit 159a6e9a5a

View File

@ -858,10 +858,21 @@ class Worker(ServiceCommandSection):
# noinspection PyBroadException
try:
result = task_session.send_request(
service='tasks',
action='get_all',
version='2.15',
method=Request.def_method,
json={'id': [task_id], 'only_fields': ["runtime"], 'search_hidden': True}
)
runtime = result.json().get("data", {}).get("tasks", [])[0].get("runtime") or {}
runtime[self.hostname_task_runtime_prop] = socket.gethostname()
res = task_session.send_request(
service='tasks', action='edit', method=Request.def_method,
json={
"task": task_id, "force": True, "runtime": {self.hostname_task_runtime_prop: socket.gethostname()}
"task": task_id, "force": True, "runtime": runtime
},
)
if not res.ok: