mirror of
https://github.com/clearml/clearml
synced 2025-04-22 15:25:22 +00:00
Add Task._set_runtime_property
This commit is contained in:
parent
f9d1bebf3d
commit
3e767fd304
@ -1801,6 +1801,20 @@ class Task(IdObjectBase, AccessMixin, SetupUploadMixin):
|
|||||||
except Exception:
|
except Exception:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
def _set_runtime_properties(self, runtime_properties):
|
||||||
|
# type: (Mapping[str, str]) -> bool
|
||||||
|
if not Session.check_min_api_version('2.13') or not runtime_properties:
|
||||||
|
return False
|
||||||
|
|
||||||
|
with self._edit_lock:
|
||||||
|
self.reload()
|
||||||
|
current_runtime_properties = self.data.runtime or {}
|
||||||
|
current_runtime_properties.update(runtime_properties)
|
||||||
|
# noinspection PyProtectedMember
|
||||||
|
self._edit(runtime=current_runtime_properties)
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
def _clear_task(self, system_tags=None, comment=None):
|
def _clear_task(self, system_tags=None, comment=None):
|
||||||
# type: (Optional[Sequence[str]], Optional[str]) -> ()
|
# type: (Optional[Sequence[str]], Optional[str]) -> ()
|
||||||
self._data.script = tasks.Script(
|
self._data.script = tasks.Script(
|
||||||
|
@ -76,11 +76,8 @@ class ResourceMonitor(BackgroundMonitor):
|
|||||||
try:
|
try:
|
||||||
machine_spec = self._get_machine_specs()
|
machine_spec = self._get_machine_specs()
|
||||||
if machine_spec:
|
if machine_spec:
|
||||||
self._task.reload()
|
|
||||||
runtime_properties = self._task.data.runtime or {}
|
|
||||||
runtime_properties.update(machine_spec)
|
|
||||||
# noinspection PyProtectedMember
|
# noinspection PyProtectedMember
|
||||||
self._task._edit(runtime=runtime_properties)
|
self._task._set_runtime_properties(runtime_properties=machine_spec)
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
logging.getLogger('clearml.resource_monitor').debug(
|
logging.getLogger('clearml.resource_monitor').debug(
|
||||||
'Failed logging machine specification: {}'.format(ex))
|
'Failed logging machine specification: {}'.format(ex))
|
||||||
|
Loading…
Reference in New Issue
Block a user