Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SVLT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ALMF
SVLT
Commits
58f2e40f
Commit
58f2e40f
authored
7 months ago
by
Christopher Randolph Rhodes
Browse files
Options
Downloads
Patches
Plain Diff
Can read accessor from file with name in path itself
parent
d166583b
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
model_server/base/api.py
+1
-1
1 addition, 1 deletion
model_server/base/api.py
tests/base/test_api.py
+5
-17
5 additions, 17 deletions
tests/base/test_api.py
tests/test_ilastik/test_ilastik.py
+4
-18
4 additions, 18 deletions
tests/test_ilastik/test_ilastik.py
with
10 additions
and
36 deletions
model_server/base/api.py
+
1
−
1
View file @
58f2e40f
...
@@ -78,7 +78,7 @@ def get_accessor(accessor_id: str):
...
@@ -78,7 +78,7 @@ def get_accessor(accessor_id: str):
def
delete_accessor
(
accessor_id
:
str
):
def
delete_accessor
(
accessor_id
:
str
):
return
_session_accessor
(
session
.
del_accessor
,
accessor_id
)
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
):
def
read_accessor_from_file
(
filename
:
str
,
accessor_id
:
Union
[
str
,
None
]
=
None
):
fp
=
session
.
paths
[
'
inbound_images
'
]
/
filename
fp
=
session
.
paths
[
'
inbound_images
'
]
/
filename
if
not
fp
.
exists
():
if
not
fp
.
exists
():
...
...
This diff is collapsed.
Click to expand it.
tests/base/test_api.py
+
5
−
17
View file @
58f2e40f
...
@@ -11,6 +11,7 @@ from model_server.base.session import session
...
@@ -11,6 +11,7 @@ from model_server.base.session import session
from
tests.base.test_model
import
DummyInstanceSegmentationModel
,
DummySemanticSegmentationModel
from
tests.base.test_model
import
DummyInstanceSegmentationModel
,
DummySemanticSegmentationModel
czifile
=
conf
.
meta
[
'
image_files
'
][
'
czifile
'
]
czifile
=
conf
.
meta
[
'
image_files
'
][
'
czifile
'
]
cfn
=
czifile
[
'
name
'
]
"""
"""
Configure additional endpoints for testing
Configure additional endpoints for testing
...
@@ -64,7 +65,7 @@ class TestServerTestCase(conf.TestServerBaseClass):
...
@@ -64,7 +65,7 @@ class TestServerTestCase(conf.TestServerBaseClass):
resp
=
self
.
_get
(
'
paths
'
)
resp
=
self
.
_get
(
'
paths
'
)
pa
=
resp
.
json
()[
'
inbound_images
'
]
pa
=
resp
.
json
()[
'
inbound_images
'
]
outpath
=
Path
(
pa
)
/
c
zifile
[
'
name
'
]
outpath
=
Path
(
pa
)
/
c
fn
copyfile
(
copyfile
(
czifile
[
'
path
'
],
czifile
[
'
path
'
],
outpath
outpath
...
@@ -129,12 +130,7 @@ class TestApiFromAutomatedClient(TestServerTestCase):
...
@@ -129,12 +130,7 @@ class TestApiFromAutomatedClient(TestServerTestCase):
def
test_pipeline_errors_when_ids_not_found
(
self
):
def
test_pipeline_errors_when_ids_not_found
(
self
):
self
.
copy_input_file_to_server
()
self
.
copy_input_file_to_server
()
model_id
=
self
.
_put
(
f
'
testing/models/dummy_semantic/load
'
).
json
()[
'
model_id
'
]
model_id
=
self
.
_put
(
f
'
testing/models/dummy_semantic/load
'
).
json
()[
'
model_id
'
]
in_acc_id
=
self
.
_put
(
in_acc_id
=
self
.
_put
(
f
'
accessors/read_from_file/
{
cfn
}
'
).
json
()
f
'
accessors/read_from_file
'
,
query
=
{
'
filename
'
:
czifile
[
'
name
'
],
},
).
json
()
# respond with 409 for invalid accessor_id
# respond with 409 for invalid accessor_id
self
.
assertEqual
(
self
.
assertEqual
(
...
@@ -158,12 +154,7 @@ class TestApiFromAutomatedClient(TestServerTestCase):
...
@@ -158,12 +154,7 @@ class TestApiFromAutomatedClient(TestServerTestCase):
def
test_i2i_dummy_inference_by_api
(
self
):
def
test_i2i_dummy_inference_by_api
(
self
):
self
.
copy_input_file_to_server
()
self
.
copy_input_file_to_server
()
model_id
=
self
.
_put
(
f
'
testing/models/dummy_semantic/load
'
).
json
()[
'
model_id
'
]
model_id
=
self
.
_put
(
f
'
testing/models/dummy_semantic/load
'
).
json
()[
'
model_id
'
]
in_acc_id
=
self
.
_put
(
in_acc_id
=
self
.
_put
(
f
'
accessors/read_from_file/
{
cfn
}
'
).
json
()
f
'
accessors/read_from_file
'
,
query
=
{
'
filename
'
:
czifile
[
'
name
'
],
},
).
json
()
# run segmentation pipeline on preloaded accessor
# run segmentation pipeline on preloaded accessor
resp_infer
=
self
.
_put
(
resp_infer
=
self
.
_put
(
...
@@ -246,10 +237,7 @@ class TestApiFromAutomatedClient(TestServerTestCase):
...
@@ -246,10 +237,7 @@ class TestApiFromAutomatedClient(TestServerTestCase):
# add accessor to session
# add accessor to session
resp_add_acc
=
self
.
_put
(
resp_add_acc
=
self
.
_put
(
f
'
accessors/read_from_file
'
,
f
'
accessors/read_from_file/
{
cfn
}
'
,
query
=
{
'
filename
'
:
czifile
[
'
name
'
],
},
)
)
acc_id
=
resp_add_acc
.
json
()
acc_id
=
resp_add_acc
.
json
()
self
.
assertTrue
(
acc_id
.
startswith
(
'
auto_
'
))
self
.
assertTrue
(
acc_id
.
startswith
(
'
auto_
'
))
...
...
This diff is collapsed.
Click to expand it.
tests/test_ilastik/test_ilastik.py
+
4
−
18
View file @
58f2e40f
...
@@ -15,6 +15,7 @@ data = conf.meta['image_files']
...
@@ -15,6 +15,7 @@ data = conf.meta['image_files']
output_path
=
conf
.
meta
[
'
output_path
'
]
output_path
=
conf
.
meta
[
'
output_path
'
]
params
=
conf
.
meta
[
'
roiset
'
]
params
=
conf
.
meta
[
'
roiset
'
]
czifile
=
conf
.
meta
[
'
image_files
'
][
'
czifile
'
]
czifile
=
conf
.
meta
[
'
image_files
'
][
'
czifile
'
]
cfn
=
czifile
[
'
name
'
]
ilastik_classifiers
=
conf
.
meta
[
'
ilastik_classifiers
'
]
ilastik_classifiers
=
conf
.
meta
[
'
ilastik_classifiers
'
]
def
_random_int
(
*
args
):
def
_random_int
(
*
args
):
...
@@ -305,12 +306,7 @@ class TestIlastikOverApi(conf.TestServerBaseClass):
...
@@ -305,12 +306,7 @@ class TestIlastikOverApi(conf.TestServerBaseClass):
def
test_ilastik_infer_pixel_probability
(
self
):
def
test_ilastik_infer_pixel_probability
(
self
):
self
.
_copy_input_file_to_server
()
self
.
_copy_input_file_to_server
()
model_id
=
self
.
test_load_ilastik_pixel_model
()
model_id
=
self
.
test_load_ilastik_pixel_model
()
in_acc_id
=
self
.
_put
(
in_acc_id
=
self
.
_put
(
f
'
accessors/read_from_file/
{
cfn
}
'
).
json
()
f
'
accessors/read_from_file
'
,
query
=
{
'
filename
'
:
czifile
[
'
name
'
],
},
).
json
()
resp_infer
=
self
.
_put
(
resp_infer
=
self
.
_put
(
f
'
pipelines/segment
'
,
f
'
pipelines/segment
'
,
...
@@ -324,12 +320,7 @@ class TestIlastikOverApi(conf.TestServerBaseClass):
...
@@ -324,12 +320,7 @@ class TestIlastikOverApi(conf.TestServerBaseClass):
px_model_id
=
self
.
test_load_ilastik_pixel_model
()
px_model_id
=
self
.
test_load_ilastik_pixel_model
()
ob_model_id
=
self
.
test_load_ilastik_pxmap_to_obj_model
()
ob_model_id
=
self
.
test_load_ilastik_pxmap_to_obj_model
()
in_acc_id
=
self
.
_put
(
in_acc_id
=
self
.
_put
(
f
'
accessors/read_from_file/
{
cfn
}
'
).
json
()
f
'
accessors/read_from_file
'
,
query
=
{
'
filename
'
:
czifile
[
'
name
'
],
},
).
json
()
resp_infer
=
self
.
_put
(
resp_infer
=
self
.
_put
(
'
ilastik/pipelines/pixel_then_object_classification/infer/
'
,
'
ilastik/pipelines/pixel_then_object_classification/infer/
'
,
...
@@ -410,12 +401,7 @@ class TestIlastikOnMultichannelInputs(conf.TestServerBaseClass):
...
@@ -410,12 +401,7 @@ class TestIlastikOnMultichannelInputs(conf.TestServerBaseClass):
Path
(
self
.
_get
(
'
paths
'
).
json
()[
'
inbound_images
'
])
/
self
.
pa_input_image
.
name
Path
(
self
.
_get
(
'
paths
'
).
json
()[
'
inbound_images
'
])
/
self
.
pa_input_image
.
name
)
)
in_acc_id
=
self
.
_put
(
in_acc_id
=
self
.
_put
(
f
'
accessors/read_from_file/
{
self
.
pa_input_image
.
name
}
'
).
json
()
f
'
accessors/read_from_file
'
,
query
=
{
'
filename
'
:
self
.
pa_input_image
.
name
},
).
json
()
resp_load_px
=
self
.
_put
(
resp_load_px
=
self
.
_put
(
'
ilastik/seg/load/
'
,
'
ilastik/seg/load/
'
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment