mirror of
https://github.com/clearml/clearml
synced 2025-02-07 21:33:25 +00:00
Add TrainsJob.is_completed()/is_aborted()
This commit is contained in:
parent
fd165f7126
commit
d148fe8042
@ -35,10 +35,12 @@ class TrainsJob(object):
|
|||||||
self.task = Task.clone(base_task_id, parent=parent or base_task_id, **kwargs)
|
self.task = Task.clone(base_task_id, parent=parent or base_task_id, **kwargs)
|
||||||
if tags:
|
if tags:
|
||||||
self.task.set_tags(list(set(self.task.get_tags()) | set(tags)))
|
self.task.set_tags(list(set(self.task.get_tags()) | set(tags)))
|
||||||
|
self.task_parameter_override = None
|
||||||
if parameter_override:
|
if parameter_override:
|
||||||
params = self.task.get_parameters_as_dict()
|
params = self.task.get_parameters_as_dict()
|
||||||
params.update(parameter_override)
|
params.update(parameter_override)
|
||||||
self.task.set_parameters_as_dict(params)
|
self.task.set_parameters_as_dict(params)
|
||||||
|
self.task_parameter_override = dict(**parameter_override)
|
||||||
if task_overrides:
|
if task_overrides:
|
||||||
# todo: make sure it works
|
# todo: make sure it works
|
||||||
# noinspection PyProtectedMember
|
# noinspection PyProtectedMember
|
||||||
@ -217,6 +219,24 @@ class TrainsJob(object):
|
|||||||
"""
|
"""
|
||||||
return self.task.status in (Task.TaskStatusEnum.failed, )
|
return self.task.status in (Task.TaskStatusEnum.failed, )
|
||||||
|
|
||||||
|
def is_completed(self):
|
||||||
|
# type: () -> bool
|
||||||
|
"""
|
||||||
|
Return True, if job is has executed and completed successfully
|
||||||
|
|
||||||
|
:return: True the task is currently in completed or published state
|
||||||
|
"""
|
||||||
|
return self.task.status in (Task.TaskStatusEnum.completed, Task.TaskStatusEnum.published)
|
||||||
|
|
||||||
|
def is_aborted(self):
|
||||||
|
# type: () -> bool
|
||||||
|
"""
|
||||||
|
Return True, if job is has executed and aborted
|
||||||
|
|
||||||
|
:return: True the task is currently in aborted state
|
||||||
|
"""
|
||||||
|
return self.task.status in (Task.TaskStatusEnum.stopped, )
|
||||||
|
|
||||||
def is_pending(self):
|
def is_pending(self):
|
||||||
# type: () -> bool
|
# type: () -> bool
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user