-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf(robot-server): Discriminate command unions (#14286)
Closes RSS-128. * Update command unions. * Update stateless command unions. * Work around Pydantic bug. * Fix names and docstrings for union workarounds. * Update tests. * Update command schema.
- Loading branch information
1 parent
6d596c4
commit c5bfe82
Showing
9 changed files
with
299 additions
and
181 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,57 @@ | ||
"""Command requests and responses allowed to be used with /commands.""" | ||
from typing import Union | ||
from typing_extensions import Annotated | ||
|
||
from pydantic import Field | ||
|
||
from opentrons.protocol_engine import commands | ||
|
||
StatelessCommandCreate = Union[ | ||
commands.HomeCreate, | ||
commands.SetRailLightsCreate, | ||
commands.SetStatusBarCreate, | ||
commands.magnetic_module.EngageCreate, | ||
commands.magnetic_module.DisengageCreate, | ||
commands.temperature_module.SetTargetTemperatureCreate, | ||
commands.temperature_module.DeactivateTemperatureCreate, | ||
commands.thermocycler.SetTargetBlockTemperatureCreate, | ||
commands.thermocycler.SetTargetLidTemperatureCreate, | ||
commands.thermocycler.DeactivateBlockCreate, | ||
commands.thermocycler.DeactivateLidCreate, | ||
commands.thermocycler.OpenLidCreate, | ||
commands.thermocycler.CloseLidCreate, | ||
commands.heater_shaker.SetTargetTemperatureCreate, | ||
commands.heater_shaker.SetAndWaitForShakeSpeedCreate, | ||
commands.heater_shaker.DeactivateHeaterCreate, | ||
commands.heater_shaker.DeactivateShakerCreate, | ||
commands.heater_shaker.OpenLabwareLatchCreate, | ||
commands.heater_shaker.CloseLabwareLatchCreate, | ||
StatelessCommandCreate = Annotated[ | ||
Union[ | ||
commands.HomeCreate, | ||
commands.SetRailLightsCreate, | ||
commands.SetStatusBarCreate, | ||
commands.magnetic_module.EngageCreate, | ||
commands.magnetic_module.DisengageCreate, | ||
commands.temperature_module.SetTargetTemperatureCreate, | ||
commands.temperature_module.DeactivateTemperatureCreate, | ||
commands.thermocycler.SetTargetBlockTemperatureCreate, | ||
commands.thermocycler.SetTargetLidTemperatureCreate, | ||
commands.thermocycler.DeactivateBlockCreate, | ||
commands.thermocycler.DeactivateLidCreate, | ||
commands.thermocycler.OpenLidCreate, | ||
commands.thermocycler.CloseLidCreate, | ||
commands.heater_shaker.SetTargetTemperatureCreate, | ||
commands.heater_shaker.SetAndWaitForShakeSpeedCreate, | ||
commands.heater_shaker.DeactivateHeaterCreate, | ||
commands.heater_shaker.DeactivateShakerCreate, | ||
commands.heater_shaker.OpenLabwareLatchCreate, | ||
commands.heater_shaker.CloseLabwareLatchCreate, | ||
], | ||
Field(discriminator="commandType"), | ||
] | ||
|
||
StatelessCommand = Union[ | ||
commands.Home, | ||
commands.SetRailLights, | ||
commands.SetStatusBar, | ||
commands.magnetic_module.Engage, | ||
commands.magnetic_module.Disengage, | ||
commands.temperature_module.SetTargetTemperature, | ||
commands.temperature_module.DeactivateTemperature, | ||
commands.thermocycler.SetTargetBlockTemperature, | ||
commands.thermocycler.SetTargetLidTemperature, | ||
commands.thermocycler.DeactivateBlock, | ||
commands.thermocycler.DeactivateLid, | ||
commands.thermocycler.OpenLid, | ||
commands.thermocycler.CloseLid, | ||
commands.heater_shaker.SetTargetTemperature, | ||
commands.heater_shaker.SetAndWaitForShakeSpeed, | ||
commands.heater_shaker.DeactivateHeater, | ||
commands.heater_shaker.DeactivateShaker, | ||
commands.heater_shaker.OpenLabwareLatch, | ||
commands.heater_shaker.CloseLabwareLatch, | ||
StatelessCommand = Annotated[ | ||
Union[ | ||
commands.Home, | ||
commands.SetRailLights, | ||
commands.SetStatusBar, | ||
commands.magnetic_module.Engage, | ||
commands.magnetic_module.Disengage, | ||
commands.temperature_module.SetTargetTemperature, | ||
commands.temperature_module.DeactivateTemperature, | ||
commands.thermocycler.SetTargetBlockTemperature, | ||
commands.thermocycler.SetTargetLidTemperature, | ||
commands.thermocycler.DeactivateBlock, | ||
commands.thermocycler.DeactivateLid, | ||
commands.thermocycler.OpenLid, | ||
commands.thermocycler.CloseLid, | ||
commands.heater_shaker.SetTargetTemperature, | ||
commands.heater_shaker.SetAndWaitForShakeSpeed, | ||
commands.heater_shaker.DeactivateHeater, | ||
commands.heater_shaker.DeactivateShaker, | ||
commands.heater_shaker.OpenLabwareLatch, | ||
commands.heater_shaker.CloseLabwareLatch, | ||
], | ||
Field(discriminator="commandType"), | ||
] |
Oops, something went wrong.