Skip to content

Commit 3bc2986

Browse files
committed
moved check jobs
1 parent 572b703 commit 3bc2986

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

check_jobs.py

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/usr/bin/env python3
2+
"""Quick script to check recent jobs in the database."""
3+
4+
from stringsight.database import SessionLocal
5+
from stringsight.models.job import Job
6+
from datetime import datetime
7+
8+
db = SessionLocal()
9+
try:
10+
# Get the 10 most recent jobs
11+
jobs = db.query(Job).order_by(Job.created_at.desc()).limit(10).all()
12+
13+
print(f"\n{'='*100}")
14+
print(f"Recent Jobs (most recent first)")
15+
print(f"{'='*100}\n")
16+
17+
if not jobs:
18+
print("No jobs found in database.")
19+
else:
20+
for job in jobs:
21+
print(f"Job ID: {job.id}")
22+
print(f" Status: {job.status}")
23+
print(f" Type: {job.job_type if hasattr(job, 'job_type') else 'N/A'}")
24+
print(f" Progress: {job.progress * 100:.1f}%")
25+
print(f" Result Path: {job.result_path}")
26+
print(f" Created: {job.created_at}")
27+
if job.error_message:
28+
print(f" Error: {job.error_message[:200]}")
29+
print(f" {'-'*98}")
30+
31+
print(f"\n{'='*100}")
32+
print("Jobs with Issues (failed, no result_path, or incomplete)")
33+
print(f"{'='*100}\n")
34+
35+
problem_jobs = [j for j in jobs if j.status == 'failed' or
36+
(j.status == 'completed' and not j.result_path)]
37+
38+
if problem_jobs:
39+
for job in problem_jobs:
40+
print(f"⚠️ Job ID: {job.id}")
41+
print(f" Status: {job.status}")
42+
print(f" Result Path: {job.result_path or 'MISSING'}")
43+
if job.error_message:
44+
print(f" Error: {job.error_message}")
45+
print()
46+
else:
47+
print("✅ No problematic jobs found in recent 10")
48+
49+
finally:
50+
db.close()

0 commit comments

Comments
 (0)