Skip to content

Commit 81f4696

Browse files
authored
add route for processing parameters (#403)
#307
1 parent 58bf130 commit 81f4696

File tree

3 files changed

+36
-0
lines changed

3 files changed

+36
-0
lines changed

openeo_driver/backend.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -894,6 +894,28 @@ def file_formats(self) -> dict:
894894
"""
895895
return {"input": {}, "output": {}}
896896

897+
def processing_parameters(self) -> dict:
898+
"""
899+
List the available processing parameters in the format defined by openEO processing parameters extension.
900+
901+
https://github.com/Open-EO/openeo-api/blob/draft/extensions/processing-parameters/openapi.yaml
902+
903+
Example output:
904+
```
905+
{
906+
"name": "memory"
907+
"description": "Maximum amount of memory that will be allocated for processing, in gigabytes."
908+
"optional": True
909+
"default": 32
910+
"schema":{
911+
"type": "integer"
912+
"minimum": 1
913+
}
914+
}
915+
```
916+
"""
917+
return {}
918+
897919
def load_disk_data(
898920
self, format: str, glob_pattern: str, options: dict, load_params: LoadParameters, env: EvalEnv
899921
) -> DriverDataCube:

openeo_driver/views.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,12 @@ def output_formats():
507507
def file_formats():
508508
return jsonify(backend_implementation.file_formats())
509509

510+
@api_endpoint(version=ComparableVersion("1.0.0").or_higher)
511+
@blueprint.route('/processing_parameters')
512+
@backend_implementation.cache_control
513+
def processing_parameters():
514+
return jsonify(backend_implementation.processing_parameters())
515+
510516
@api_endpoint
511517
@blueprint.route('/udf_runtimes')
512518
@backend_implementation.cache_control

tests/test_views.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@ def test_capabilities_endpoints(self, api100):
258258
assert endpoints["/processes"] == ["GET"]
259259
assert endpoints["/udf_runtimes"] == ["GET"]
260260
assert endpoints["/file_formats"] == ["GET"]
261+
assert endpoints["/processing_parameters"] == ["GET"]
261262
assert endpoints["/service_types"] == ["GET"]
262263
assert endpoints["/services"] == ["GET", "POST"]
263264
assert endpoints["/services/{service_id}"] == ["DELETE", "GET"]
@@ -565,6 +566,13 @@ def test_file_formats(self, api100):
565566
}
566567
assert response.headers["Cache-Control"] == "max-age=900, public"
567568

569+
def test_processing_parameters(self, api100):
570+
response = api100.get('/processing_parameters')
571+
resp = response.assert_status_code(200).json
572+
assert resp == {}
573+
assert response.headers["Cache-Control"] == "max-age=900, public"
574+
575+
568576
@pytest.mark.parametrize(
569577
["user_id", "expect_success"],
570578
[

0 commit comments

Comments
 (0)