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
77aca6fd
Commit
77aca6fd
authored
9 months ago
by
Christopher Randolph Rhodes
Browse files
Options
Downloads
Patches
Plain Diff
Catch discrepancy in UNIX v. Windows-style paths
parent
a44e8a96
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
model_server/base/session.py
+2
-2
2 additions, 2 deletions
model_server/base/session.py
tests/test_session.py
+5
-7
5 additions, 7 deletions
tests/test_session.py
with
7 additions
and
9 deletions
model_server/base/session.py
+
2
−
2
View file @
77aca6fd
import
logging
import
os
from
pathlib
import
Path
from
pathlib
import
Path
,
PureWindowsPath
from
pydantic
import
BaseModel
from
time
import
strftime
,
localtime
from
typing
import
Union
...
...
@@ -183,7 +183,7 @@ class Session(object, metaclass=Singleton):
models
=
self
.
describe_loaded_models
()
for
mid
,
det
in
models
.
items
():
if
is_path
:
if
Path
(
det
.
get
(
'
params
'
).
get
(
key
))
==
Path
(
value
):
if
PureWindows
Path
(
det
.
get
(
'
params
'
).
get
(
key
))
.
as_posix
()
==
Path
(
value
)
.
as_posix
()
:
return
mid
else
:
if
det
.
get
(
'
params
'
).
get
(
key
)
==
value
:
...
...
This diff is collapsed.
Click to expand it.
tests/test_session.py
+
5
−
7
View file @
77aca6fd
import
json
from
os.path
import
exists
import
pathlib
from
pydantic
import
BaseModel
...
...
@@ -6,7 +5,6 @@ import unittest
from
model_server.base.models
import
DummySemanticSegmentationModel
from
model_server.base.session
import
Session
from
model_server.base.workflows
import
WorkflowRunRecord
class
TestGetSessionObject
(
unittest
.
TestCase
):
def
setUp
(
self
)
->
None
:
...
...
@@ -117,11 +115,11 @@ class TestGetSessionObject(unittest.TestCase):
class
_PM
(
BaseModel
):
path
:
str
p1
=
_PM
(
path
=
'
c:
\\
windows
\\
dummy.pa
'
)
p2
=
_PM
(
path
=
'
c:/windows/dummy.pa
'
)
mid
=
self
.
sesh
.
load_model
(
MC
,
params
=
p1
)
assert
pathlib
.
Path
(
p1
.
path
)
==
pathlib
.
Path
(
p2
.
path
)
find_mid
=
self
.
sesh
.
find_param_in_loaded_models
(
'
path
'
,
p2
.
path
,
is_path
=
True
)
mod_pw
=
_PM
(
path
=
'
c:
\\
windows
\\
dummy.pa
'
)
mod_pu
=
_PM
(
path
=
'
c:/windows/dummy.pa
'
)
mid
=
self
.
sesh
.
load_model
(
MC
,
params
=
mod_pw
)
find_mid
=
self
.
sesh
.
find_param_in_loaded_models
(
'
path
'
,
mod_pu
.
path
,
is_path
=
True
)
self
.
assertEqual
(
mid
,
find_mid
)
def
test_change_output_path
(
self
):
...
...
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