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
66ed7fa5
Commit
66ed7fa5
authored
1 year ago
by
Eva Bardou
Committed by
Yoann Schneider
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Catch `403` and `500` error responses when calling `ValidateModelVersion`
parent
a3f95189
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!533
Catch `403` and `500` error responses when calling `ValidateModelVersion`
Pipeline
#168918
passed
1 year ago
Stage: test
Stage: build
Stage: release
Stage: deploy
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
arkindex_worker/worker/training.py
+9
-0
9 additions, 0 deletions
arkindex_worker/worker/training.py
tests/test_elements_worker/test_training.py
+35
-0
35 additions, 0 deletions
tests/test_elements_worker/test_training.py
with
44 additions
and
0 deletions
arkindex_worker/worker/training.py
+
9
−
0
View file @
66ed7fa5
...
...
@@ -280,8 +280,17 @@ class TrainingMixin:
},
)
except
ErrorResponse
as
e
:
# Temporary fix while waiting for `ValidateModelVersion` refactoring as it can
# return errors even when the model version is properly validated
if
e
.
status_code
in
[
403
,
500
]:
logger
.
warning
(
f
'
An error occurred while validating model version
{
self
.
model_version
[
"
id
"
]
}
, please check its status.
'
)
return
if
e
.
status_code
!=
409
:
raise
e
logger
.
warning
(
f
"
An available model version exists with hash
{
hash
}
, using it instead of the pending version.
"
)
...
...
This diff is collapsed.
Click to expand it.
tests/test_elements_worker/test_training.py
+
35
−
0
View file @
66ed7fa5
...
...
@@ -179,6 +179,41 @@ def test_validate_model_version_not_created(mock_training_worker):
mock_training_worker
.
validate_model_version
(
hash
=
"
a
"
,
size
=
1
,
archive_hash
=
"
b
"
)
@pytest.mark.parametrize
(
"
status_code
"
,
[
403
,
500
])
def
test_validate_model_version_catch_errors
(
mocker
,
mock_training_worker
,
caplog
,
status_code
):
mocker
.
patch
(
"
arkindex_worker.worker.base.BaseWorker.request.retry.retry
"
,
return_value
=
False
)
mock_training_worker
.
model_version
=
{
"
id
"
:
"
model_version_id
"
}
args
=
{
"
hash
"
:
"
hash
"
,
"
archive_hash
"
:
"
archive_hash
"
,
"
size
"
:
30
,
}
mock_training_worker
.
api_client
.
add_error_response
(
"
ValidateModelVersion
"
,
id
=
"
model_version_id
"
,
status_code
=
status_code
,
body
=
args
,
)
mock_training_worker
.
validate_model_version
(
**
args
)
assert
mock_training_worker
.
model_version
==
{
"
id
"
:
"
model_version_id
"
}
assert
[
(
level
,
message
)
for
module
,
level
,
message
in
caplog
.
record_tuples
if
module
==
"
arkindex_worker
"
]
==
[
(
logging
.
WARNING
,
"
An error occurred while validating model version model_version_id, please check its status.
"
,
),
]
@pytest.mark.parametrize
(
"
deletion_failed
"
,
[
True
,
False
])
def
test_validate_model_version_hash_conflict
(
mock_training_worker
,
default_model_version
,
caplog
,
deletion_failed
...
...
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