Skip to content

Commit

Permalink
Make default behavior configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
denniswittich committed Aug 26, 2024
1 parent 56f228b commit 3edfd59
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ The detector can be configured to use a specific model version, to automatically
- Configure the detector to automatically update the model version: `curl -X PUT -d "follow_loop" http://localhost/model_version`
- Pause the model updates: `curl -X PUT -d "pause" http://localhost/model_version`

Note that the configuration is not persistent and will be reset to the default value ("follow_loop") after a restart of the detector.
Note that the configuration is not persistent, however, the default behavior on startup can be configured via the environment variable `VERSION_CONTROL_DEFAULT`.
If the environment variable is set to `VERSION_CONTROL_DEFAULT=PAUSE`, the detector will pause the model updates on startup. Otherwise, the detector will automatically follow the loop deployment target.

### Changing the outbox mode

Expand Down
3 changes: 2 additions & 1 deletion learning_loop_node/detector/detector_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ def __init__(self, name: str, detector: DetectorLogic, uuid: Optional[str] = Non
# FollowLoop: the detector node will follow the loop and update the model if necessary
# SpecificVersion: the detector node will update to a specific version, set via the /model_version endpoint
# Pause: the detector node will not update the model
self.version_control: rest_version_control.VersionMode = rest_version_control.VersionMode.FollowLoop
self.version_control: rest_version_control.VersionMode = rest_version_control.VersionMode.Pause if os.environ.get(
'VERSION_CONTROL_DEFAULT', 'follow_loop').lower() == 'pause' else rest_version_control.VersionMode.FollowLoop
self.target_model: Optional[ModelInformation] = None
self.loop_deployment_target: Optional[ModelInformation] = None

Expand Down
2 changes: 1 addition & 1 deletion learning_loop_node/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from .data_classes import NodeStatus
from .data_exchanger import DataExchanger
from .helpers import log_conf
from .helpers.misc import activate_asyncio_warnings, ensure_socket_response, read_or_create_uuid
from .helpers.misc import ensure_socket_response, read_or_create_uuid
from .loop_communication import LoopCommunicator


Expand Down

0 comments on commit 3edfd59

Please sign in to comment.