mirror of
https://github.com/clearml/clearml
synced 2025-06-23 01:55:38 +00:00
Add status_message support to Task.mark_stopped()
This commit is contained in:
parent
0ebed74968
commit
be1478e67a
@ -573,11 +573,11 @@ class Task(IdObjectBase, AccessMixin, SetupUploadMixin):
|
|||||||
""" The signal that this Task started. """
|
""" The signal that this Task started. """
|
||||||
return self.send(tasks.StartedRequest(self.id, force=force), ignore_errors=ignore_errors)
|
return self.send(tasks.StartedRequest(self.id, force=force), ignore_errors=ignore_errors)
|
||||||
|
|
||||||
def stopped(self, ignore_errors=True, force=False, status_reason=None):
|
def stopped(self, ignore_errors=True, force=False, status_reason=None, status_message=None):
|
||||||
# type: (bool, bool, Optional[str]) -> ()
|
# type: (bool, bool, Optional[str], Optional[str]) -> ()
|
||||||
""" The signal that this Task stopped. """
|
""" The signal that this Task stopped. """
|
||||||
return self.send(
|
return self.send(
|
||||||
tasks.StoppedRequest(self.id, force=force, status_reason=status_reason),
|
tasks.StoppedRequest(self.id, force=force, status_reason=status_reason, status_message=status_message),
|
||||||
ignore_errors=ignore_errors
|
ignore_errors=ignore_errors
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -591,7 +591,14 @@ class Task(IdObjectBase, AccessMixin, SetupUploadMixin):
|
|||||||
|
|
||||||
def mark_completed(self, ignore_errors=True, status_message=None, force=False):
|
def mark_completed(self, ignore_errors=True, status_message=None, force=False):
|
||||||
# type: (bool, Optional[str], bool) -> ()
|
# type: (bool, Optional[str], bool) -> ()
|
||||||
""" The signal indicating that this Task completed. """
|
"""
|
||||||
|
Manually mark a Task as completed
|
||||||
|
|
||||||
|
:param bool ignore_errors: If True (default), ignore any errors raised
|
||||||
|
:param bool force: If True the task status will be changed to `stopped` regardless of the current Task state.
|
||||||
|
:param str status_message: Optional, add status change message to the stop request.
|
||||||
|
This message will be stored as status_message on the Task's info panel
|
||||||
|
"""
|
||||||
if hasattr(tasks, 'CompletedRequest') and callable(tasks.CompletedRequest):
|
if hasattr(tasks, 'CompletedRequest') and callable(tasks.CompletedRequest):
|
||||||
return self.send(
|
return self.send(
|
||||||
tasks.CompletedRequest(self.id, status_reason='completed', status_message=status_message, force=force),
|
tasks.CompletedRequest(self.id, status_reason='completed', status_message=status_message, force=force),
|
||||||
|
@ -1454,17 +1454,19 @@ class Task(_Task):
|
|||||||
self.started(force=force)
|
self.started(force=force)
|
||||||
self.reload()
|
self.reload()
|
||||||
|
|
||||||
def mark_stopped(self, force=False):
|
def mark_stopped(self, force=False, status_message=None):
|
||||||
# type: (bool) -> ()
|
# type: (bool, Optional[str]) -> ()
|
||||||
"""
|
"""
|
||||||
Manually mark a Task as stopped (also used in :meth:`_at_exit`)
|
Manually mark a Task as stopped (also used in :meth:`_at_exit`)
|
||||||
|
|
||||||
:param bool force: If True the task status will be changed to `stopped` regardless of the current Task state.
|
:param bool force: If True the task status will be changed to `stopped` regardless of the current Task state.
|
||||||
|
:param str status_message: Optional, add status change message to the stop request.
|
||||||
|
This message will be stored as status_message on the Task's info panel
|
||||||
"""
|
"""
|
||||||
# flush any outstanding logs
|
# flush any outstanding logs
|
||||||
self.flush(wait_for_uploads=True)
|
self.flush(wait_for_uploads=True)
|
||||||
# mark task as stopped
|
# mark task as stopped
|
||||||
self.stopped(force=force)
|
self.stopped(force=force, status_message=str(status_message) if status_message else None)
|
||||||
|
|
||||||
def flush(self, wait_for_uploads=False):
|
def flush(self, wait_for_uploads=False):
|
||||||
# type: (bool) -> bool
|
# type: (bool) -> bool
|
||||||
|
Loading…
Reference in New Issue
Block a user