Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
Base Worker
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
Workers
Base Worker
Commits
c80438e2
Verified
Commit
c80438e2
authored
2 years ago
by
Yoann Schneider
Browse files
Options
Downloads
Patches
Plain Diff
nits and earlier raising if model dir does not exist
parent
bf73055f
No related branches found
No related tags found
1 merge request
!217
Find local model directory method
Pipeline
#79614
passed
2 years ago
Stage: test
Stage: build
Stage: release
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
arkindex_worker/worker/base.py
+7
-9
7 additions, 9 deletions
arkindex_worker/worker/base.py
with
7 additions
and
9 deletions
arkindex_worker/worker/base.py
+
7
−
9
View file @
c80438e2
...
...
@@ -50,8 +50,6 @@ class ModelNotFoundError(Exception):
Exception raised when the path towards the model is invalid
"""
pass
class
BaseWorker
(
object
):
"""
...
...
@@ -105,7 +103,7 @@ class BaseWorker(object):
# To load models locally
self
.
parser
.
add_argument
(
"
--model-dir
"
,
help
=
(
"
The path to a local model
'
s directory
.
"
),
help
=
(
"
The path to a local model
'
s directory
(development only).
"
),
type
=
Path
,
)
...
...
@@ -369,19 +367,19 @@ class BaseWorker(object):
# downloads the model and set it in the current task work dir
return
Path
(
self
.
work_dir
)
else
:
model_
path
=
self
.
config
.
get
(
"
model_dir
"
,
self
.
args
.
model_dir
)
if
model_
path
is
None
:
model_
dir
=
self
.
config
.
get
(
"
model_dir
"
,
self
.
args
.
model_dir
)
if
model_
dir
is
None
:
raise
ModelNotFoundError
(
"
No path to the model was provided.
"
"
Please provide model_dir either through configuration
"
"
or as CLI argument.
"
)
if
Path
(
model_path
).
exists
():
return
Path
(
model_path
)
else
:
model_dir
=
Path
(
model_dir
)
if
not
model_dir
.
exists
():
raise
ModelNotFoundError
(
f
"
The path
{
model_
path
}
does not link to any directory
"
f
"
The path
{
model_
dir
}
does not link to any directory
"
)
return
model_dir
@retry
(
retry
=
retry_if_exception
(
_is_500_error
),
...
...
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