Skip to content
Draft
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
2 changes: 2 additions & 0 deletions openeo_driver/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,8 @@ def to_api_dict(self, full=True, api_version: ComparableVersion = None) -> dict:
usage["memory"] = {"value": int(round(self.memory_time_megabyte.total_seconds())), "unit": "mb-seconds"}
if usage:
result["usage"] = usage
if self.job_options:
result.update(self.job_options)

if api_version and api_version.below("1.0.0"):
result["process_graph"] = result.pop("process", {}).get("process_graph")
Expand Down
20 changes: 20 additions & 0 deletions tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1663,6 +1663,26 @@ def test_get_job_info_100(self, api100):
"process": {"process_graph": {"foo": {"process_id": "foo", "arguments": {}}}},
}

def test_get_job_info_with_job_options(self, api100):
with self._fresh_job_registry() as registry:
registry[TEST_USER, "job-123"] = BatchJobMetadata(
id="job-123",
status="created",
created=datetime(2024, 1, 2, 13, 14, 15),
process={"process_graph": {"foo": {"process_id": "foo", "arguments": {}}}},
job_options={"driver-memory": "3g", "executor-memory": "5g"},
)
resp = api100.get("/jobs/job-123", headers=self.AUTH_HEADER)
assert resp.assert_status_code(200).json == {
"id": "job-123",
"status": "created",
"progress": 0,
"created": "2024-01-02T13:14:15Z",
"process": {"process_graph": {"foo": {"process_id": "foo", "arguments": {}}}},
"driver-memory": "3g",
"executor-memory": "5g",
}

def test_get_job_info_invalid(self, api):
resp = api.get("/jobs/deadbeef-f00", headers=self.AUTH_HEADER).assert_error(404, "JobNotFound")
assert resp.json["message"] == "The batch job 'deadbeef-f00' does not exist."
Expand Down