From 1b04c468539baa7bf44520f18a79a88c1f836983 Mon Sep 17 00:00:00 2001 From: Matthias Bisping Date: Thu, 5 May 2022 17:25:42 +0200 Subject: [PATCH] removed code related to eager endpoint --- pyinfra/server/server.py | 9 --------- test/exploration_tests/partial_response_test.py | 12 ------------ test/fixtures/input.py | 17 ++--------------- test/unit_tests/pipeline_test.py | 11 +++-------- 4 files changed, 5 insertions(+), 44 deletions(-) delete mode 100644 test/exploration_tests/partial_response_test.py diff --git a/pyinfra/server/server.py b/pyinfra/server/server.py index 81fd8be..5e017e3 100644 --- a/pyinfra/server/server.py +++ b/pyinfra/server/server.py @@ -32,10 +32,6 @@ class Processor(abc.ABC): self.execution_queue = chain([]) self.processor_fn = processor_fn - # def run(self, package, final): - # """Eagerly execute processor function and return result immediately.""" - # return self.processor_fn(package, final=final) - def submit(self, package, final): """Submit computation request to execution queue; computation is performed on demand. @@ -61,11 +57,6 @@ def set_up_processing_server(process_fn): resp.status_code = 200 return resp - # @app.route("/process", methods=["POST", "PATCH"]) - # def process(): - # response_payload = processor.run(request.json, final=request.method == "POST") - # return jsonify(response_payload) - @app.route("/submit", methods=["POST", "PATCH"]) def submit(): processor.submit(request.json, final=request.method == "POST") diff --git a/test/exploration_tests/partial_response_test.py b/test/exploration_tests/partial_response_test.py deleted file mode 100644 index 1de349e..0000000 --- a/test/exploration_tests/partial_response_test.py +++ /dev/null @@ -1,12 +0,0 @@ -# import pytest -# from funcy import lmap -# -# from pyinfra.server.rest import process_eagerly -# from pyinfra.server.utils import unpack -# -# -# @pytest.mark.parametrize("batched", [True, False]) -# @pytest.mark.parametrize("item_type", ["pdf", "string", "image"]) -# def test_sending_partial_request(url, input_data_items, metadata, target_data_items, server_process): -# output = lmap(unpack, process_eagerly(f"{url}/process", input_data_items, metadata)) -# assert output == target_data_items diff --git a/test/fixtures/input.py b/test/fixtures/input.py index ec3100d..82ccf2d 100644 --- a/test/fixtures/input.py +++ b/test/fixtures/input.py @@ -38,11 +38,8 @@ def target_data_items(input_data_items, item_type, operation, metadata): @pytest.fixture -def endpoint(url, analysis_type): - return { - # "eager": f"{url}/process", - "lazy": f"{url}/submit", - }[analysis_type] +def endpoint(url): + return f"{url}/submit" @pytest.fixture(params=[0, 2, 5]) @@ -55,16 +52,6 @@ def n_pages(request): return request.param -@pytest.fixture( - params=[ - # "eager", - "lazy", - ] -) -def analysis_type(request): - return request.param - - @pytest.fixture(params=[1, 5]) def buffer_size(request): return request.param diff --git a/test/unit_tests/pipeline_test.py b/test/unit_tests/pipeline_test.py index 9c3e6ad..36f5014 100644 --- a/test/unit_tests/pipeline_test.py +++ b/test/unit_tests/pipeline_test.py @@ -39,9 +39,7 @@ def test_mock_pipeline(): ) @pytest.mark.parametrize( "n_pages", - [ - 100 - ], + [100], ) def test_pipeline(pipeline, input_data_items, metadata, target_data_items): output = lmap(unpack, pipeline(input_data_items, metadata)) @@ -59,8 +57,5 @@ def rest_pipeline(server_process, endpoint, rest_interpreter): @pytest.fixture -def rest_interpreter(analysis_type): - return { - "eager": IdentityInterpreter(), - "lazy": rcompose(RestPickupStreamer(), RestReceiver()), - }[analysis_type] +def rest_interpreter(): + rcompose(RestPickupStreamer(), RestReceiver())