mirror of
https://github.com/clearml/clearml-agent
synced 2025-06-26 18:16:15 +00:00
Fix do not set Aborted task if it is already set to Failed
This commit is contained in:
parent
3585786348
commit
4881b9638d
@ -3485,16 +3485,24 @@ class Worker(ServiceCommandSection):
|
||||
session = session or self._session
|
||||
try:
|
||||
if stop_reason == TaskStopReason.stopped:
|
||||
self.log("Stopping - tasks.stop was called for task")
|
||||
self.send_logs(task_id, ["Process aborted by user"], session=session)
|
||||
session.send_api(
|
||||
tasks_api.StoppedRequest(
|
||||
task=task_id,
|
||||
status_reason="task was stopped by tasks.stop",
|
||||
status_message=self._task_status_change_message,
|
||||
force=False
|
||||
# do not change the status to stopped if the Task status is already failed
|
||||
task_status = get_task(
|
||||
session, task_id, only_fields=["status"]
|
||||
).status
|
||||
if str(task_status) == "failed":
|
||||
self.send_logs(task_id, ["Process aborted by user - Task status was Failed"], session=session)
|
||||
self.log("Stopping - task was already marked as failed")
|
||||
else:
|
||||
self.send_logs(task_id, ["Process aborted by user"], session=session)
|
||||
self.log("Stopping - tasks.stop was called for task")
|
||||
session.send_api(
|
||||
tasks_api.StoppedRequest(
|
||||
task=task_id,
|
||||
status_reason="task was stopped by tasks.stop",
|
||||
status_message=self._task_status_change_message,
|
||||
force=False
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
elif stop_reason == TaskStopReason.status_changed:
|
||||
try:
|
||||
|
Loading…
Reference in New Issue
Block a user