Skip to content
Merged
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
23 changes: 21 additions & 2 deletions job_executor/adapter/datastore_api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,14 @@ def get_jobs(
if query_fields:
request_url += f"?{'&'.join(query_fields)}"

response = execute_request("GET", request_url, True)
response = execute_request(
"GET",
request_url,
True,
headers={
"X-API-Key": DATASTORE_API_SERVICE_KEY,
},
)
return [Job.model_validate(job) for job in response.json()]


Expand All @@ -83,14 +90,26 @@ def update_job_status(
payload: dict[str, JobStatus | str] = {"status": str(new_status)}
if log is not None:
payload.update({"log": log})
execute_request("PUT", f"{DATASTORE_API_URL}/jobs/{job_id}", json=payload)
execute_request(
"PUT",
f"{DATASTORE_API_URL}/jobs/{job_id}",
json=payload,
headers={
"Content-Type": "application/json",
"X-API-Key": DATASTORE_API_SERVICE_KEY,
},
)


def update_description(job_id: str, new_description: str) -> None:
execute_request(
"PUT",
f"{DATASTORE_API_URL}/jobs/{job_id}",
json={"description": new_description},
headers={
"Content-Type": "application/json",
"X-API-Key": DATASTORE_API_SERVICE_KEY,
},
)


Expand Down