job fix
This commit is contained in:
1 parent
25ab7dfce7
commit
c98e89b5e4
3 files changed
+49
-9
No files matched your search
+33
@@ -0,0 +1,33 @@
|
||||
# Python virtual environment
|
||||
.venv/
|
||||
venv/
|
||||
env/
|
||||
|
||||
# Job persistence file (runtime data)
|
||||
jobs.json
|
||||
|
||||
# Processed files and temporary data
|
||||
processed/
|
||||
static/uploads/
|
||||
*.log
|
||||
failed_extractions.log
|
||||
|
||||
# Python cache
|
||||
__pycache__/
|
||||
*.pyc
|
||||
*.pyo
|
||||
*.pyd
|
||||
|
||||
# IDE files
|
||||
.vscode/
|
||||
.idea/
|
||||
*.swp
|
||||
*.swo
|
||||
|
||||
# OS files
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
|
||||
# Temporary files
|
||||
*.tmp
|
||||
*.temp
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"2024-01-01_12-00-00": {
|
||||
"status": "processing",
|
||||
"status": "completed",
|
||||
"files": [
|
||||
{
|
||||
"name": "test.pdf",
|
||||
|
||||
+15
-8
@@ -1210,19 +1210,23 @@ def delete_job(job_id):
|
||||
@app.route('/completed-jobs')
|
||||
@login_required
|
||||
def completed_jobs():
|
||||
# Filter only completed jobs
|
||||
completed_jobs = {job_id: job for job_id, job in job_queue.items() if job.get('status') == 'completed'}
|
||||
# Show ALL jobs with their statuses for debugging
|
||||
all_jobs = job_queue
|
||||
return render_template_string('''
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Completed Jobs Archive</title>
|
||||
<title>All Jobs Status</title>
|
||||
<style>
|
||||
body { font-family: Arial, sans-serif; background-color: #f4f4f4; margin: 0; padding: 20px; text-align: center; }
|
||||
img { margin-bottom: 20px; }
|
||||
h1 { color: #333; }
|
||||
.job { background-color: #fff; margin: 10px auto; padding: 15px; border-radius: 10px; box-shadow: 0 0 10px rgba(0,0,0,0.1); max-width: 1000px; text-align: left; }
|
||||
.status { padding: 5px 10px; border-radius: 5px; color: white; font-weight: bold; background-color: #28a745; }
|
||||
.status { padding: 5px 10px; border-radius: 5px; color: white; font-weight: bold; }
|
||||
.status.completed { background-color: #28a745; }
|
||||
.status.processing { background-color: #17a2b8; }
|
||||
.status.error { background-color: #dc3545; }
|
||||
.progress-text { color: #17a2b8; font-style: italic; margin-left: 10px; }
|
||||
.download-btn { background-color: #007bff; color: white; text-decoration: none; padding: 8px 16px; border-radius: 5px; margin: 5px; display: inline-block; }
|
||||
.download-btn:hover { background-color: #0056b3; }
|
||||
.delete-btn { background-color: #dc3545; color: white; border: none; padding: 8px 16px; border-radius: 5px; margin: 5px; cursor: pointer; }
|
||||
@@ -1254,7 +1258,7 @@ def completed_jobs():
|
||||
<body>
|
||||
<a href="/logout" class="logout">Logout</a>
|
||||
<img src="/static/trbc-logo-full.png" alt="Logo" width="200">
|
||||
<h1>Completed Jobs Archive</h1>
|
||||
<h1>All Jobs Status</h1>
|
||||
<div class="nav-links">
|
||||
<a href="/" class="nav-btn">← Upload Files</a>
|
||||
<a href="/jobs" class="nav-btn">View All Jobs →</a>
|
||||
@@ -1266,12 +1270,15 @@ def completed_jobs():
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
{% for job_id, job in jobs.items() %}
|
||||
{% for job_id, job in all_jobs.items() %}
|
||||
<div class="job">
|
||||
<h3>Job {{ job_id[:8] }} - {{ job.created_at if job.created_at else 'Unknown Date' }}</h3>
|
||||
<div class="job-stats">
|
||||
<span class="status">Completed</span>
|
||||
<span class="status {{ job.status }}">{{ job.status.title() }}</span>
|
||||
<span class="file-count">{{ job.processed_files|selectattr('0', 'equalto', 'success')|list|length }} files processed</span>
|
||||
{% if job.progress %}
|
||||
<span class="progress-text">Progress: {{ job.progress }}</span>
|
||||
{% endif %}
|
||||
{% if job.skipped %}
|
||||
<span style="color: #856404; font-weight: bold;">{{ job.skipped|length }} files skipped</span>
|
||||
{% endif %}
|
||||
@@ -1340,7 +1347,7 @@ def completed_jobs():
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
''', jobs=completed_jobs)
|
||||
''', all_jobs=all_jobs)
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(debug=True, port=3000)
|
||||
Reference in new issue
Block a user