Fix job sorting and ensure absolute paths for remote deployment
- Change JOBS_FILE and RESULTS_DIR to absolute paths using os.path.abspath - Fix job sorting in /jobs route to use datetime objects instead of strings - This should resolve issues with jobs not appearing or processing on remote server
This commit is contained in:
1 parent
27a6b637c5
commit
111b1c9a6d
1 file changed
+3
-3
@@ -269,8 +269,8 @@ def logout():
|
||||
return redirect(url_for('index'))
|
||||
|
||||
# Job storage
|
||||
JOBS_FILE = os.path.join(os.path.dirname(__file__), 'jobs.json')
|
||||
RESULTS_DIR = 'results'
|
||||
JOBS_FILE = os.path.abspath(os.path.join(os.path.dirname(__file__), 'jobs.json'))
|
||||
RESULTS_DIR = os.path.abspath('results')
|
||||
os.makedirs(RESULTS_DIR, exist_ok=True)
|
||||
|
||||
processing_complete = False
|
||||
@@ -443,7 +443,7 @@ def jobs():
|
||||
jobs = load_jobs()
|
||||
print(f"Loaded {len(jobs)} jobs: {list(jobs.keys())}")
|
||||
# Sort jobs by timestamp, newest first
|
||||
sorted_jobs = sorted(jobs.values(), key=lambda x: str(x.get('timestamp', '')), reverse=True)
|
||||
sorted_jobs = sorted(jobs.values(), key=lambda x: x.get('timestamp', datetime.min), reverse=True)
|
||||
print(f"Sorted jobs count: {len(sorted_jobs)}")
|
||||
if sorted_jobs:
|
||||
print(f"First job: {sorted_jobs[0].get('id')} status: {sorted_jobs[0].get('status')}")
|
||||
|
||||
Reference in new issue
Block a user