semantic cleanup
This commit is contained in:
@@ -1,10 +1,17 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Script to delete tasks with RUNNING status from the database."""
|
||||
# [DEF:backend.delete_running_tasks:Module]
|
||||
# @PURPOSE: Script to delete tasks with RUNNING status from the database.
|
||||
# @LAYER: Utility
|
||||
# @SEMANTICS: maintenance, database, cleanup
|
||||
|
||||
from sqlalchemy.orm import Session
|
||||
from src.core.database import TasksSessionLocal
|
||||
from src.models.task import TaskRecord
|
||||
|
||||
# [DEF:delete_running_tasks:Function]
|
||||
# @PURPOSE: Delete all tasks with RUNNING status from the database.
|
||||
# @PRE: Database is accessible and TaskRecord model is defined.
|
||||
# @POST: All tasks with status 'RUNNING' are removed from the database.
|
||||
def delete_running_tasks():
|
||||
"""Delete all tasks with RUNNING status from the database."""
|
||||
session: Session = TasksSessionLocal()
|
||||
@@ -30,6 +37,8 @@ def delete_running_tasks():
|
||||
print(f"Error deleting tasks: {e}")
|
||||
finally:
|
||||
session.close()
|
||||
# [/DEF:delete_running_tasks:Function]
|
||||
|
||||
if __name__ == "__main__":
|
||||
delete_running_tasks()
|
||||
# [/DEF:backend.delete_running_tasks:Module]
|
||||
|
||||
Reference in New Issue
Block a user