diff --git a/openeo_driver/backend.py b/openeo_driver/backend.py index f9dd7128..48a2d944 100644 --- a/openeo_driver/backend.py +++ b/openeo_driver/backend.py @@ -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") diff --git a/tests/test_views.py b/tests/test_views.py index 79f424a6..40617e2d 100644 --- a/tests/test_views.py +++ b/tests/test_views.py @@ -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."