mirror of
https://github.com/microsoft/onefuzz.git
synced 2025-06-12 01:58:18 +00:00
mark tasks that are stopped that never started with an error (#935)
This commit is contained in:
@ -195,6 +195,11 @@ class Task(BASE_TASK, ORMMixin):
|
||||
)
|
||||
return
|
||||
|
||||
if self.state not in TaskState.has_started():
|
||||
self.mark_failed(
|
||||
Error(code=ErrorCode.TASK_FAILED, errors=["task never started"])
|
||||
)
|
||||
|
||||
self.set_state(TaskState.stopping)
|
||||
|
||||
def mark_failed(
|
||||
|
@ -19,7 +19,7 @@ def main(mytimer: func.TimerRequest, dashboard: func.Out[str]) -> None: # noqa:
|
||||
expired_tasks = Task.search_expired()
|
||||
for task in expired_tasks:
|
||||
logging.info("stopping expired task: %s", task.job_id)
|
||||
task.stopping()
|
||||
task.mark_stopping()
|
||||
|
||||
expired_jobs = Job.search_expired()
|
||||
for job in expired_jobs:
|
||||
|
Reference in New Issue
Block a user