Skip to content
Snippets Groups Projects
Commit a44c8249 authored by Yoann Schneider's avatar Yoann Schneider :tennis: Committed by Bastien Abadie
Browse files

Use the is_read_only property to determine read-only mode

parent 5781d885
No related branches found
No related tags found
1 merge request!315Use the is_read_only property to determine read-only mode
Pipeline #80167 passed
......@@ -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"
)
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment