diff --git a/model_server/base/api.py b/model_server/base/api.py index 217e10326b0da47378459675c91553d92e533133..a54bbf6a60f40c39f8d61c013ec58ca84c242b2c 100644 --- a/model_server/base/api.py +++ b/model_server/base/api.py @@ -78,7 +78,7 @@ def get_accessor(accessor_id: str): def delete_accessor(accessor_id: str): return _session_accessor(session.del_accessor, accessor_id) -@app.put('/accessors/read_from_file') +@app.put('/accessors/read_from_file/{filename}') def read_accessor_from_file(filename: str, accessor_id: Union[str, None] = None): fp = session.paths['inbound_images'] / filename if not fp.exists(): diff --git a/tests/base/test_api.py b/tests/base/test_api.py index bf5bc87e888190a6b26877187928c087a50953f4..b60b0e4e2afc1dba04b4f4f382867ba42981f9e0 100644 --- a/tests/base/test_api.py +++ b/tests/base/test_api.py @@ -11,6 +11,7 @@ from model_server.base.session import session from tests.base.test_model import DummyInstanceSegmentationModel, DummySemanticSegmentationModel czifile = conf.meta['image_files']['czifile'] +cfn = czifile['name'] """ Configure additional endpoints for testing @@ -64,7 +65,7 @@ class TestServerTestCase(conf.TestServerBaseClass): resp = self._get('paths') pa = resp.json()['inbound_images'] - outpath = Path(pa) / czifile['name'] + outpath = Path(pa) / cfn copyfile( czifile['path'], outpath @@ -129,12 +130,7 @@ class TestApiFromAutomatedClient(TestServerTestCase): def test_pipeline_errors_when_ids_not_found(self): self.copy_input_file_to_server() model_id = self._put(f'testing/models/dummy_semantic/load').json()['model_id'] - in_acc_id = self._put( - f'accessors/read_from_file', - query={ - 'filename': czifile['name'], - }, - ).json() + in_acc_id = self._put(f'accessors/read_from_file/{cfn}').json() # respond with 409 for invalid accessor_id self.assertEqual( @@ -158,12 +154,7 @@ class TestApiFromAutomatedClient(TestServerTestCase): def test_i2i_dummy_inference_by_api(self): self.copy_input_file_to_server() model_id = self._put(f'testing/models/dummy_semantic/load').json()['model_id'] - in_acc_id = self._put( - f'accessors/read_from_file', - query={ - 'filename': czifile['name'], - }, - ).json() + in_acc_id = self._put(f'accessors/read_from_file/{cfn}').json() # run segmentation pipeline on preloaded accessor resp_infer = self._put( @@ -246,10 +237,7 @@ class TestApiFromAutomatedClient(TestServerTestCase): # add accessor to session resp_add_acc = self._put( - f'accessors/read_from_file', - query={ - 'filename': czifile['name'], - }, + f'accessors/read_from_file/{cfn}', ) acc_id = resp_add_acc.json() self.assertTrue(acc_id.startswith('auto_')) diff --git a/tests/test_ilastik/test_ilastik.py b/tests/test_ilastik/test_ilastik.py index 7cdf01a58c7cd2248eb24d61a3d6acbb1cba3620..8a68a2cdbf471e387dc2d237ef12cbdd1e23cfc6 100644 --- a/tests/test_ilastik/test_ilastik.py +++ b/tests/test_ilastik/test_ilastik.py @@ -15,6 +15,7 @@ data = conf.meta['image_files'] output_path = conf.meta['output_path'] params = conf.meta['roiset'] czifile = conf.meta['image_files']['czifile'] +cfn = czifile['name'] ilastik_classifiers = conf.meta['ilastik_classifiers'] def _random_int(*args): @@ -305,12 +306,7 @@ class TestIlastikOverApi(conf.TestServerBaseClass): def test_ilastik_infer_pixel_probability(self): self._copy_input_file_to_server() model_id = self.test_load_ilastik_pixel_model() - in_acc_id = self._put( - f'accessors/read_from_file', - query={ - 'filename': czifile['name'], - }, - ).json() + in_acc_id = self._put(f'accessors/read_from_file/{cfn}').json() resp_infer = self._put( f'pipelines/segment', @@ -324,12 +320,7 @@ class TestIlastikOverApi(conf.TestServerBaseClass): px_model_id = self.test_load_ilastik_pixel_model() ob_model_id = self.test_load_ilastik_pxmap_to_obj_model() - in_acc_id = self._put( - f'accessors/read_from_file', - query={ - 'filename': czifile['name'], - }, - ).json() + in_acc_id = self._put(f'accessors/read_from_file/{cfn}').json() resp_infer = self._put( 'ilastik/pipelines/pixel_then_object_classification/infer/', @@ -410,12 +401,7 @@ class TestIlastikOnMultichannelInputs(conf.TestServerBaseClass): Path(self._get('paths').json()['inbound_images']) / self.pa_input_image.name ) - in_acc_id = self._put( - f'accessors/read_from_file', - query={ - 'filename': self.pa_input_image.name - }, - ).json() + in_acc_id = self._put(f'accessors/read_from_file/{self.pa_input_image.name}').json() resp_load_px = self._put( 'ilastik/seg/load/',