Skip to content

Commit c9982e1

Browse files
committed
prefer predefined process over udp
#353
1 parent 80b1ff6 commit c9982e1

File tree

3 files changed

+15
-8
lines changed

3 files changed

+15
-8
lines changed

openeo_driver/ProcessGraphDeserializer.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1848,7 +1848,7 @@ def apply_process(process_id: str, args: dict, namespace: Union[str, None], env:
18481848
_log.debug("Using process {p!r} from namespace 'user'.".format(p=process_id))
18491849
return evaluate_udp(process_id=process_id, udp=udp, args=args, env=env)
18501850

1851-
raise ProcessUnsupportedException(process=process_id, namespace=namespace)
1851+
raise ProcessUnsupportedException(process=process_id, namespace=namespace)
18521852

18531853

18541854

tests/test_views_execute.py

+13-6
Original file line numberDiff line numberDiff line change
@@ -2647,6 +2647,13 @@ def test_udp_apply_neighborhood(api, udp_registry, set_parameter):
26472647

26482648

26492649
def test_user_defined_process_udp_vs_pdp_priority(api, udp_registry):
2650+
"""
2651+
See https://github.com/Open-EO/openeo-python-driver/issues/353
2652+
This test was effectively asserting that the backend correctly follows API.
2653+
Unfortunately, the prescribed behaviour of allowing to override predefined processes is somewhat questionable.
2654+
On top of that, it lead to a major operational issue.
2655+
When the above issue is resolved, this test should be adjusted to check the desired behaviour.
2656+
"""
26502657
api.set_auth_bearer_token(TEST_USER_BEARER_TOKEN)
26512658
# First without a defined "ndvi" UDP
26522659
api.check_result("udp_ndvi.json")
@@ -2659,12 +2666,12 @@ def test_user_defined_process_udp_vs_pdp_priority(api, udp_registry):
26592666
udp_registry.save(user_id=TEST_USER, process_id="ndvi", spec=api.load_json("udp/myndvi.json"))
26602667
api.check_result("udp_ndvi.json")
26612668
dummy = dummy_backend.get_collection("S2_FOOBAR")
2662-
assert dummy.ndvi.call_count == 1
2663-
assert dummy.reduce_dimension.call_count == 1
2664-
dummy.reduce_dimension.assert_called_with(reducer=mock.ANY, dimension="bands", context=None, env=mock.ANY)
2665-
args, kwargs = dummy.reduce_dimension.call_args
2666-
assert "red" in kwargs["reducer"]
2667-
assert "nir" in kwargs["reducer"]
2669+
assert dummy.ndvi.call_count == 2
2670+
assert dummy.reduce_dimension.call_count == 0
2671+
#dummy.reduce_dimension.assert_called_with(reducer=mock.ANY, dimension="bands", context=None, env=mock.ANY)
2672+
#args, kwargs = dummy.reduce_dimension.call_args
2673+
#assert "red" in kwargs["reducer"]
2674+
#assert "nir" in kwargs["reducer"]
26682675

26692676

26702677
def test_execute_03_style_filter_bbox(api):

tests/test_views_validation.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def test_basic_ok(api100):
2424
(
2525
{"add": {"process_id": "fluxbormav", "arguments": {"x": 3, "y": 5}, "result": True}},
2626
"ProcessUnsupported",
27-
"Process with identifier 'fluxbormav' is not available in namespace 'backend'.",
27+
"Process with identifier 'fluxbormav' is not available in namespace 'None'.",
2828
),
2929
(
3030
{"lc": {"process_id": "load_collection", "arguments": {"id": "flehmeh"}, "result": True}},

0 commit comments

Comments
 (0)