Skip to content

Commit

Permalink
Merge pull request #573 from wri/job_link
Browse files Browse the repository at this point in the history
GTC-2939 Add job_link to OTF list response
  • Loading branch information
danscales authored Aug 13, 2024
2 parents 0fe58c1 + 120aa7c commit e9041cf
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/models/pydantic/user_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

class UserJob(BaseModel):
job_id: UUID
job_link: Optional[str]
status: str = "pending"
download_link: Optional[str] = None
failed_geometries_link: Optional[str] = None
Expand Down
4 changes: 3 additions & 1 deletion app/routes/datasets/queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from pglast.parser import ParseError
from pglast.printer import RawStream
from pydantic.tools import parse_obj_as
from app.settings.globals import API_URL

from ...application import db
from ...authentication.api_keys import get_api_key
Expand Down Expand Up @@ -419,7 +420,8 @@ async def query_dataset_list_post(
logger.error(error)
return HTTPException(500, "There was an error starting your job.")

return UserJobResponse(data=UserJob(job_id=job_id))
job_link = f"{API_URL}/job/{job_id}"
return UserJobResponse(data=UserJob(job_id=job_id, job_link=job_link))


async def _start_batch_execution(job_id: UUID, input: Dict[str, Any]) -> None:
Expand Down
1 change: 1 addition & 0 deletions tests_v2/unit/app/routes/datasets/test_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,7 @@ async def test_query_batch_feature_collection(
assert False

assert str(uuid) == data["job_id"]
assert data["job_link"].endswith(f"/job/{data['job_id']}")

assert data["status"] == "pending"

Expand Down

0 comments on commit e9041cf

Please sign in to comment.