Spaces:
Sleeping
Sleeping
Commit ·
b91e2f1
1
Parent(s): e1aa508
stability: avoid job lost between polls; serialize with 1 gunicorn worker
Browse files- Dockerfile +1 -1
- backend/api/__pycache__/views.cpython-313.pyc +0 -0
- backend/api/views.py +6 -1
Dockerfile
CHANGED
|
@@ -50,6 +50,6 @@ ENV DJANGO_DEBUG=False \
|
|
| 50 |
EXPOSE 7860
|
| 51 |
|
| 52 |
# Run DB migrations at container start, then start gunicorn
|
| 53 |
-
CMD ["sh", "-c", "python manage.py migrate --noinput && gunicorn core.wsgi:application --bind 0.0.0.0:${PORT} --workers
|
| 54 |
|
| 55 |
|
|
|
|
| 50 |
EXPOSE 7860
|
| 51 |
|
| 52 |
# Run DB migrations at container start, then start gunicorn
|
| 53 |
+
CMD ["sh", "-c", "python manage.py migrate --noinput && gunicorn core.wsgi:application --bind 0.0.0.0:${PORT} --workers 1 --threads 4 --timeout 120"]
|
| 54 |
|
| 55 |
|
backend/api/__pycache__/views.cpython-313.pyc
CHANGED
|
Binary files a/backend/api/__pycache__/views.cpython-313.pyc and b/backend/api/__pycache__/views.cpython-313.pyc differ
|
|
|
backend/api/views.py
CHANGED
|
@@ -271,7 +271,12 @@ class ResultView(APIView):
|
|
| 271 |
|
| 272 |
job = job_info['job']
|
| 273 |
try:
|
| 274 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 275 |
log_backend_message(f"ResultView: Job {job_id} status is '{status_name}'.")
|
| 276 |
|
| 277 |
if status_name == "finished":
|
|
|
|
| 271 |
|
| 272 |
job = job_info['job']
|
| 273 |
try:
|
| 274 |
+
try:
|
| 275 |
+
status_name = job.status().code.name.lower()
|
| 276 |
+
except Exception:
|
| 277 |
+
# If the client discarded the job (e.g., remote space returned 404 on queue),
|
| 278 |
+
# treat as finished to force a result fetch attempt which surfaces the error.
|
| 279 |
+
status_name = "finished"
|
| 280 |
log_backend_message(f"ResultView: Job {job_id} status is '{status_name}'.")
|
| 281 |
|
| 282 |
if status_name == "finished":
|