-
Notifications
You must be signed in to change notification settings - Fork 176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(system-server,robot-server,api): add ability to enable OEM Mode when setting enableOEMMode advanced setting. #14832
Conversation
…bleOEMMode feature flag is changed.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## edge #14832 +/- ##
==========================================
- Coverage 67.50% 67.49% -0.02%
==========================================
Files 2521 2525 +4
Lines 72090 72124 +34
Branches 9311 9311
==========================================
+ Hits 48666 48677 +11
- Misses 21228 21251 +23
Partials 2196 2196
Flags with carried forward coverage won't be shown. Click here to find out more.
|
@@ -76,3 +76,8 @@ def enable_error_recovery_experiments() -> bool: | |||
return advs.get_setting_with_env_overload( | |||
"enableErrorRecoveryExperiments", RobotTypeEnum.FLEX | |||
) | |||
|
|||
def oem_mode_enabled() -> bool: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good but perhaps this should be passed robot type instead of assume it. We've had problems with feature flags before where we assume type in the past and had to correct it, like with enable_door_safety_switch
. If this is passed an OT-2 robot type I'd expect we'd just raise an error, or do nothing at all?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should do nothing on the OT2, since all the logic that deals with OEM mode is on the client side.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is unused in the current build (and is not planned to be used) should we simply removed it all together?
make sure robot type is RobotTypeEnum.FLEX when setting the enableOEMMode
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall everything looks good so far from my perspective. The justification for the odd coupling order (enabled OEM: client -> robot server -> system server, upload image: client -> system server) of the robot server, system server and client for file writing makes sense given actions occurring. However, we may want to note this decision for future divisions of labor between the system and robot servers to more cleanly separate the order of operations if any similar features are developed in the future.
try: | ||
# send request to system server if this is the enableOEMMode setting | ||
if update.id == "enableOEMMode" and robot_type == RobotTypeEnum.FLEX: | ||
resp = await set_oem_mode_request(update.value) | ||
if resp != 200: | ||
# TODO: raise correct error here | ||
raise Exception(f"Something went wrong setting OEM Mode. err: {resp}") | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed, the except handlers for the raised Exception below here are probably sufficient for the error response we'd want, so this should be okay.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
correct
@@ -76,3 +76,8 @@ def enable_error_recovery_experiments() -> bool: | |||
return advs.get_setting_with_env_overload( | |||
"enableErrorRecoveryExperiments", RobotTypeEnum.FLEX | |||
) | |||
|
|||
def oem_mode_enabled() -> bool: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is unused in the current build (and is not planned to be used) should we simply removed it all together?
def save_settings(settings: SystemServerSettings) -> bool: | ||
"""Save the settings to the dotenv file.""" | ||
env_path = Environment().dot_env_path | ||
env_path = env_path or f"{settings.persistence_directory}/system.env" | ||
prefix = settings.Config.env_prefix |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed the decision to have the system server responsible for this persistence file write is justified.
…via advanced settings. (#14832)
Overview
We need to change the splash screen in user space, this is managed by the systems service
opentrons-loading.service
. This pull request in oe-core (Opentrons/oe-core#143) adds the mechanism to change the splash screen via the/var/lib/opentrons-system-server/system.env
file. This pull request adds the endpoint and hooks it up to the robot-server to allow the OEM Mode to be enabled/disabled when theenableOEMMode
feature flag is changed via the/system/settings
POST request.Closes: PLAT-275 PLAT-276
Test Plan
enableOEMMode
oem_mode_enabled
flag in thesystem.env
via PUT/system/oem_mode/enable
.sysem.env
file when theenableOEMMode
advanced flag is set via POST/system/settings
.non-200
error code if PUT/system/oem_mode/enable
fails for whatever reason.enableOEMMode
advanced setting if PUT/system/oem_mode/enable
fails.Changelog
/system/oem_mode/enable
endpoint to enable/disable OEM Mode by changing thesystem.env
oem_mode_enabled
andoem_mode_splash_custom
system server config flagsoem_mode_enabled
helper function tofeature_flags.py
save_settings
method to system-server settings so we can save the SystemServerSettings to asystem.env
/system/oem_mode/enable
endpoint when theenableOEMMode
advanced settings flag is changed.Review requests
/system/oem_mode/enable
request get triggered from the robot-server.set_oem_mode_request
is not just some floating function, this should be anHTTPClient
that encapsulates HTTP requests to local endpoints. This might need to be added at a different time.Risk assessment
enableOEMMOde
advanced setting for the Flex and OT-2