Skip to content

Commit 279676e

Browse files
committed
Issue #366 update to parameter/options change in spec
related to PR Open-EO/openeo-api#471
1 parent e2e83c0 commit 279676e

File tree

5 files changed

+11
-19
lines changed

5 files changed

+11
-19
lines changed

openeo_driver/backend.py

+2
Original file line numberDiff line numberDiff line change
@@ -770,6 +770,8 @@ class OpenEoBackendImplementation:
770770
"https://api.openeo.org/1.2.0",
771771
# Support the "remote process definition" extension (originally known as the "remote-udp" extension)
772772
"https://api.openeo.org/extensions/remote-process-definition/0.1.0",
773+
# Processing Parameters extension
774+
"https://api.openeo.org/extensions/processing-parameters/0.1.0",
773775
# STAC API conformance classes
774776
# "https://api.stacspec.org/v1.0.0/core", # TODO #363 can we claim this conformance class already?
775777
"https://api.stacspec.org/v1.0.0/collections",

openeo_driver/processgraph.py

+4-14
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ class ProcessDefinition(NamedTuple):
4343
# Definition what the process returns
4444
returns: Optional[dict] = None
4545

46-
# TODO: official naming of these "processing parameter" related properties is undecided at the moment.
47-
# see https://github.com/Open-EO/openeo-api/pull/471#discussion_r1904253964
4846
default_job_options: Optional[dict] = None
4947
default_synchronous_options: Optional[dict] = None
5048

@@ -111,18 +109,10 @@ def _get_process_definition_from_url(process_id: str, url: str) -> ProcessDefini
111109
message=f"No valid process definition for {process_id!r} found at {url!r}.",
112110
)
113111

114-
# TODO: official property name for these "processing parameters" is undecided at the moment.
115-
# see https://github.com/Open-EO/openeo-api/pull/471#discussion_r1904253964
116-
if "default_job_parameters" in spec:
117-
_log.warning("Extracting experimental 'default_job_parameters' from process definition.")
118-
default_job_options = spec["default_job_parameters"]
119-
else:
120-
default_job_options = None
121-
if "default_synchronous_parameters" in spec:
122-
_log.warning("Extracting experimental 'default_synchronous_parameters' from process definition.")
123-
default_synchronous_options = spec["default_synchronous_parameters"]
124-
else:
125-
default_synchronous_options = None
112+
# Processing Parameters Extension support
113+
# (conformance class `https://api.openeo.org/extensions/processing-parameters/0.1.0`)
114+
default_job_options = spec.get("default_job_options", None)
115+
default_synchronous_options = spec.get("default_synchronous_options", None)
126116

127117
return ProcessDefinition(
128118
id=process_id,

tests/test_processgraph.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -65,17 +65,17 @@ def test_extract_default_job_options_from_process_graph(requests_mock):
6565
json={
6666
"id": "add3",
6767
"process_graph": {
68-
"add": {"process_id": "add", "arguments": {"x": {"from_parameter": "x", "y": 3}, "result": True}}
68+
"add": {"process_id": "add", "arguments": {"x": {"from_parameter": "x"}, "y": 3}, "result": True}
6969
},
7070
"parameters": [
7171
{"name": "x", "schema": {"type": "number"}},
7272
],
7373
"returns": {"schema": {"type": "number"}},
74-
"default_job_parameters": {
74+
"default_job_options": {
7575
"memory": "2GB",
7676
"cpu": "yellow",
7777
},
78-
"default_synchronous_parameters": {
78+
"default_synchronous_options": {
7979
"cpu": "green",
8080
},
8181
},

tests/test_views.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1336,7 +1336,7 @@ def test_create_job_100_with_job_options_and_defaults_from_remote_process_defini
13361336
"returns": {"schema": {"type": "number"}},
13371337
}
13381338
if default_job_options is not None:
1339-
process_definition["default_job_parameters"] = default_job_options
1339+
process_definition["default_job_options"] = default_job_options
13401340
requests_mock.get("https://share.test/add3.json", json=process_definition)
13411341

13421342
pg = {

tests/test_views_execute.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4707,7 +4707,7 @@ def test_synchronous_processing_job_options_and_defaults_from_remote_process_def
47074707
"returns": {"schema": {"type": "number"}},
47084708
}
47094709
if default_job_options is not None:
4710-
process_definition["default_synchronous_parameters"] = default_job_options
4710+
process_definition["default_synchronous_options"] = default_job_options
47114711
requests_mock.get("https://share.test/add3.json", json=process_definition)
47124712

47134713
actual_job_options = []

0 commit comments

Comments
 (0)