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
d206d455
Commit
d206d455
authored
4 months ago
by
Christopher Randolph Rhodes
Browse files
Options
Downloads
Patches
Plain Diff
Log task-related session events
parent
260f9c3a
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
model_server/base/session.py
+11
-2
11 additions, 2 deletions
model_server/base/session.py
with
11 additions
and
2 deletions
model_server/base/session.py
+
11
−
2
View file @
d206d455
...
...
@@ -60,6 +60,7 @@ class TaskCollection(object):
}
self
.
_handles
[
task_id
]
=
func
logger
.
info
(
f
'
Added task
{
task_id
}
:
{
str
(
func
)
}
'
)
return
str
(
task_id
)
...
...
@@ -84,14 +85,17 @@ class TaskCollection(object):
f
=
self
.
_handles
[
task_id
]
p
=
task
[
'
params
'
]
try
:
logger
.
info
(
f
'
Started running task
{
task_id
}
'
)
task
[
'
status
'
]
=
self
.
status_codes
[
'
in_progress
'
]
result
=
f
(
p
)
logger
.
info
(
f
'
Finished running task
{
task_id
}
'
)
task
[
'
status
'
]
=
self
.
status_codes
[
'
finished
'
]
task
[
'
result
'
]
=
result
return
result
except
Exception
as
e
:
task
[
'
status
'
]
=
self
.
status_codes
[
'
failed
'
]
task
[
'
error
'
]
=
str
(
e
)
logger
.
error
(
f
'
Error running task
{
task_id
}
:
{
str
(
e
)
}
'
)
raise
RunTaskError
(
e
)
class
_Session
(
object
):
...
...
@@ -160,6 +164,7 @@ class _Session(object):
idx
=
len
(
self
.
accessors
)
accessor_id
=
f
'
acc_
{
idx
:
06
d
}
'
self
.
accessors
[
accessor_id
]
=
{
'
loaded
'
:
True
,
'
object
'
:
acc
,
**
acc
.
info
}
self
.
log_info
(
f
'
Added accessor
{
accessor_id
}
'
)
return
accessor_id
def
del_accessor
(
self
,
accessor_id
:
str
)
->
str
:
...
...
@@ -177,6 +182,7 @@ class _Session(object):
assert
isinstance
(
v
[
'
object
'
],
GenericImageDataAccessor
)
v
[
'
loaded
'
]
=
False
v
[
'
object
'
]
=
None
self
.
log_info
(
f
'
Deleted accessor
{
accessor_id
}
'
)
return
accessor_id
def
del_all_accessors
(
self
)
->
list
[
str
]:
...
...
@@ -190,6 +196,7 @@ class _Session(object):
v
[
'
object
'
]
=
None
v
[
'
loaded
'
]
=
False
res
.
append
(
k
)
self
.
log_info
(
f
'
Deleted accessor
{
k
}
'
)
return
res
...
...
@@ -224,11 +231,12 @@ class _Session(object):
self
.
del_accessor
(
acc_id
)
return
acc
def
write_accessor
(
self
,
acc_id
:
str
,
filename
:
Union
[
str
,
None
]
=
None
,
pop
=
True
)
->
str
:
def
write_accessor
(
self
,
acc_id
:
str
,
filename
:
Union
[
str
,
None
]
=
None
,
pop
:
bool
=
True
)
->
str
:
"""
Write an accessor to file and unload it from the session
Write an accessor to file and
optionally
unload it from the session
:param acc_id: accessor
'
s ID
:param filename: force use of a specific filename, raise InvalidPathError if this already exists
:param pop: unload accessor from the session if True
:return: name of file
"""
if
filename
is
None
:
...
...
@@ -250,6 +258,7 @@ class _Session(object):
else
:
acc
.
write
(
fp
)
self
.
accessors
[
acc_id
][
'
filepath
'
]
=
fp
.
__str__
()
self
.
log_info
(
f
'
Wrote accessor
{
acc_id
}
to
{
fp
.
__str__
()
}
'
)
return
fp
.
name
def
add_roiset
(
self
,
roiset
:
RoiSet
,
roiset_id
:
str
=
None
)
->
str
:
...
...
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