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
e79f7a30
Commit
e79f7a30
authored
4 months ago
by
Christopher Randolph Rhodes
Browse files
Options
Downloads
Patches
Plain Diff
Can also pass ndarray to PipelineTrace
parent
0e7adb66
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
model_server/base/pipelines/shared.py
+9
-4
9 additions, 4 deletions
model_server/base/pipelines/shared.py
tests/base/test_pipelines.py
+7
-1
7 additions, 1 deletion
tests/base/test_pipelines.py
with
16 additions
and
5 deletions
model_server/base/pipelines/shared.py
+
9
−
4
View file @
e79f7a30
...
...
@@ -6,7 +6,7 @@ from typing import List, Union
from
fastapi
import
HTTPException
from
pydantic
import
BaseModel
,
Field
,
root_validator
from
..accessors
import
GenericImageDataAccessor
from
..accessors
import
GenericImageDataAccessor
,
InMemoryDataAccessor
from
..roiset
import
RoiSet
from
..session
import
session
,
AccessorIdError
...
...
@@ -132,13 +132,18 @@ class PipelineTrace(OrderedDict):
self
[
'
input
'
]
=
start_acc
def
__setitem__
(
self
,
key
,
value
:
GenericImageDataAccessor
):
if
self
.
enforce_accessors
:
assert
isinstance
(
value
,
GenericImageDataAccessor
),
f
'
Pipeline trace expects data accessor type
'
if
isinstance
(
value
,
GenericImageDataAccessor
):
acc
=
value
else
:
if
self
.
enforce_accessors
:
raise
NoAccessorsFoundError
(
f
'
Pipeline trace expects data accessor type
'
)
else
:
acc
=
InMemoryDataAccessor
(
value
)
if
not
self
.
allow_overwrite
and
key
in
self
.
keys
():
raise
KeyAlreadyExists
(
f
'
key
{
key
}
already exists in pipeline trace
'
)
self
.
timer
.
__setitem__
(
key
,
self
.
tfunc
()
-
self
.
last_time
)
self
.
last_time
=
self
.
tfunc
()
return
super
().
__setitem__
(
key
,
value
)
return
super
().
__setitem__
(
key
,
acc
)
def
append
(
self
,
tr
,
skip_first
=
True
):
new_tr
=
self
.
copy
()
...
...
This diff is collapsed.
Click to expand it.
tests/base/test_pipelines.py
+
7
−
1
View file @
e79f7a30
...
...
@@ -83,4 +83,10 @@ class TestSegmentationPipelines(unittest.TestCase):
trace4
=
trace1
.
append
(
trace2
,
skip_first
=
True
)
self
.
assertEqual
(
len
(
trace4
),
len
(
trace1
)
+
len
(
trace2
)
-
1
)
self
.
assertTrue
(
np
.
all
(
trace4
[
'
input
'
].
data
==
trace4
[
'
double
'
].
data
))
\ No newline at end of file
self
.
assertTrue
(
np
.
all
(
trace4
[
'
input
'
].
data
==
trace4
[
'
double
'
].
data
))
def
test_add_nda_to_trace
(
self
):
acc
=
generate_file_accessor
(
zstack
[
'
path
'
])
trace1
=
PipelineTrace
(
acc
,
enforce_accessors
=
False
)
trace1
[
'
halve
'
]
=
trace1
.
last
.
data
*
0.5
self
.
assertEqual
(
len
(
trace1
),
2
)
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