diff --git a/.dev_session/SESSION_INFO b/.dev_session/SESSION_INFO index db60109a..8f806ee8 100644 --- a/.dev_session/SESSION_INFO +++ b/.dev_session/SESSION_INFO @@ -1 +1 @@ -{"task_id": "31e88f42-8544-8024-ad7c-da1733e94f9a", "token": "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", "readme_path": "connector-superoffice/README.md", "session_start_time": "2026-03-09T08:46:32.104282"} \ No newline at end of file +{"task_id": "31e88f42-8544-8024-ad7c-da1733e94f9a", "token": "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", "readme_path": "connector-superoffice/README.md", "session_start_time": "2026-03-09T12:38:07.040119"} \ No newline at end of file diff --git a/connector-superoffice/kill_jobs.py b/connector-superoffice/kill_jobs.py new file mode 100644 index 00000000..fdf7171b --- /dev/null +++ b/connector-superoffice/kill_jobs.py @@ -0,0 +1,31 @@ +import sqlite3 +import sys + +DB_PATH = "/data/connector_queue.db" + +def kill_pending_jobs(): + """Sets the status of stuck jobs to FAILED.""" + try: + conn = sqlite3.connect(DB_PATH) + cursor = conn.cursor() + + query = """ + UPDATE jobs + SET status = 'FAILED', error_msg = 'Manually failed by admin to clear queue.' + WHERE status = 'PROCESSING' OR status = 'PENDING' + """ + + cursor.execute(query) + changes = conn.total_changes + conn.commit() + conn.close() + + print(f"OK: Successfully marked {changes} jobs as FAILED.") + return 0 + + except sqlite3.Error as e: + print(f"ERROR: Could not update jobs. Reason: {e}") + return 1 + +if __name__ == "__main__": + sys.exit(kill_pending_jobs())