From fc18d5f690f283ccd7f5f33992768eef17b139ff Mon Sep 17 00:00:00 2001 From: Dan Scales Date: Wed, 14 Aug 2024 16:01:53 -0700 Subject: [PATCH] Show associated error message in job info if status is 'error'. --- app/models/pydantic/user_job.py | 5 +++-- app/routes/jobs/job.py | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/models/pydantic/user_job.py b/app/models/pydantic/user_job.py index 69855732..7936deaf 100644 --- a/app/models/pydantic/user_job.py +++ b/app/models/pydantic/user_job.py @@ -8,8 +8,9 @@ class UserJob(BaseModel): job_id: UUID - job_link: Optional[str] - status: str = "pending" + job_link: Optional[str] # Full URL to check the job status + status: str = "pending" # Can be pending, success, partial_success, failure, and error + message: Optional[str] # Error message when status is "error" download_link: Optional[str] = None failed_geometries_link: Optional[str] = None progress: Optional[str] = "0%" diff --git a/app/routes/jobs/job.py b/app/routes/jobs/job.py index 66dc9003..92878fee 100644 --- a/app/routes/jobs/job.py +++ b/app/routes/jobs/job.py @@ -68,7 +68,8 @@ async def _get_user_job(job_id: UUID) -> UserJob: logger.error(f"Analysis service returned an unexpected response: {output}") return UserJob( job_id=job_id, - status="failed", + status="error", + message=output["message"], download_link=None, failed_geometries_link=None, progress="0%",