- Update plugins (debug, mapper, search) to explicitly map environment config to SupersetConfig - Add authenticate method to SupersetClient for explicit session management - Add get_environment method to ConfigManager - Fix navbar dropdown hover stability in frontend with invisible bridge
36 lines
1.2 KiB
Python
36 lines
1.2 KiB
Python
#!/usr/bin/env python3
|
|
"""Script to delete tasks with RUNNING status from the database."""
|
|
|
|
from sqlalchemy.orm import Session
|
|
from src.core.database import TasksSessionLocal
|
|
from src.models.task import TaskRecord
|
|
|
|
def delete_running_tasks():
|
|
"""Delete all tasks with RUNNING status from the database."""
|
|
session: Session = TasksSessionLocal()
|
|
try:
|
|
# Find all task records with RUNNING status
|
|
running_tasks = session.query(TaskRecord).filter(TaskRecord.status == "RUNNING").all()
|
|
|
|
if not running_tasks:
|
|
print("No RUNNING tasks found.")
|
|
return
|
|
|
|
print(f"Found {len(running_tasks)} RUNNING tasks:")
|
|
for task in running_tasks:
|
|
print(f"- Task ID: {task.id}, Type: {task.type}")
|
|
|
|
# Delete the found tasks
|
|
session.query(TaskRecord).filter(TaskRecord.status == "RUNNING").delete(synchronize_session=False)
|
|
session.commit()
|
|
|
|
print(f"Successfully deleted {len(running_tasks)} RUNNING tasks.")
|
|
except Exception as e:
|
|
session.rollback()
|
|
print(f"Error deleting tasks: {e}")
|
|
finally:
|
|
session.close()
|
|
|
|
if __name__ == "__main__":
|
|
delete_running_tasks()
|