Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GTC-2939 Add job_link to OTF list response #573

Merged
merged 2 commits into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading