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
a44c8249
Commit
a44c8249
authored
2 years ago
by
Yoann Schneider
Committed by
Bastien Abadie
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Use the is_read_only property to determine read-only mode
parent
5781d885
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!315
Use the is_read_only property to determine read-only mode
Pipeline
#80167
passed
2 years ago
Stage: release
Stage: deploy
Changes
2
Pipelines
6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
arkindex_worker/worker/training.py
+2
-2
2 additions, 2 deletions
arkindex_worker/worker/training.py
tests/test_elements_worker/test_training.py
+4
-1
4 additions, 1 deletion
tests/test_elements_worker/test_training.py
with
6 additions
and
3 deletions
arkindex_worker/worker/training.py
+
2
−
2
View file @
a44c8249
...
...
@@ -102,12 +102,12 @@ def build_clean_payload(**kwargs):
def
skip_if_read_only
(
func
):
"""
Return shortly in case the read_only
attribute
is evaluated to True
Return shortly in case the
is_
read_only
property
is evaluated to True
"""
@functools.wraps
(
func
)
def
wrapper
(
self
,
*
args
,
**
kwargs
):
if
getattr
(
self
,
"
read_only
"
,
False
):
if
getattr
(
self
,
"
is_
read_only
"
,
False
):
logger
.
warning
(
"
Cannot perform this operation as the worker is in read-only mode
"
)
...
...
This diff is collapsed.
Click to expand it.
tests/test_elements_worker/test_training.py
+
4
−
1
View file @
a44c8249
...
...
@@ -101,7 +101,10 @@ def test_handle_s3_uploading_errors(mock_training_worker, model_file_dir):
)
def
test_training_mixin_read_only
(
mock_training_worker
,
method
,
caplog
):
"""
All operations related to models versions returns early if the worker is configured as read only
"""
mock_training_worker
.
read_only
=
True
# Set worker in read_only mode
mock_training_worker
.
worker_run_id
=
None
assert
mock_training_worker
.
is_read_only
assert
mock_training_worker
.
model_version
is
None
getattr
(
mock_training_worker
,
method
)()
assert
mock_training_worker
.
model_version
is
None
...
...
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