Skip to content

Commit

Permalink
refactor(robot-server): remove unused liveProtocol session (#11046)
Browse files Browse the repository at this point in the history
  • Loading branch information
mcous authored Jul 11, 2022
1 parent ff3dc71 commit 4b958e7
Show file tree
Hide file tree
Showing 11 changed files with 121 additions and 181 deletions.
4 changes: 0 additions & 4 deletions robot-server/robot_server/service/session/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@
DeckCalibrationSession,
PipetteOffsetCalibrationSession,
)
from robot_server.service.session.session_types.live_protocol.session import (
LiveProtocolSession,
)

log = logging.getLogger(__name__)

Expand All @@ -30,7 +27,6 @@
SessionType.tip_length_calibration: TipLengthCalibration,
SessionType.deck_calibration: DeckCalibrationSession,
SessionType.pipette_offset_calibration: PipetteOffsetCalibrationSession,
SessionType.live_protocol: LiveProtocolSession,
}


Expand Down
30 changes: 0 additions & 30 deletions robot-server/robot_server/service/session/models/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
DeprecatedResponseDataModel,
DeprecatedMultiResponseModel,
)
from robot_server.service.session.models.common import EmptyModel


class SessionType(str, Enum):
Expand All @@ -32,8 +31,6 @@ class SessionType(str, Enum):
tip_length_calibration = "tipLengthCalibration"
deck_calibration = "deckCalibration"
pipette_offset_calibration = "pipetteOffsetCalibration"
protocol = "protocol"
live_protocol = "liveProtocol"


"""
Expand All @@ -45,17 +42,6 @@ class SessionType(str, Enum):
None,
]

"""
A Union of all the possible session detail models.
"""
SessionDetails = typing.Union[
CalibrationCheckSessionStatus,
PipetteOffsetCalibrationSessionStatus,
TipCalibrationSessionStatus,
DeckCalibrationSessionStatus,
EmptyModel,
]


class SessionCreateAttributes(BaseModel):
"""Attributes required for creating a session"""
Expand Down Expand Up @@ -100,12 +86,6 @@ class PipetteOffsetCalibrationCreateAttributes(SessionCreateAttributes):
createParams: SessionCreateParams


class LiveProtocolCreateAttributes(SessionCreateAttributesNoParams):
"""Live protocol session create request."""

sessionType: Literal[SessionType.live_protocol] = SessionType.live_protocol


class SessionResponseAttributes(DeprecatedResponseDataModel):
"""Common session response attributes."""

Expand Down Expand Up @@ -147,20 +127,11 @@ class PipetteOffsetCalibrationResponseAttributes(
details: PipetteOffsetCalibrationSessionStatus


class LiveProtocolResponseAttributes(
LiveProtocolCreateAttributes, SessionResponseAttributes
):
"""Response attributes of live protocol session."""

pass


RequestTypes = typing.Union[
CalibrationCheckCreateAttributes,
TipLengthCalibrationCreateAttributes,
DeckCalibrationCreateAttributes,
PipetteOffsetCalibrationCreateAttributes,
LiveProtocolCreateAttributes,
]


Expand All @@ -169,7 +140,6 @@ class LiveProtocolResponseAttributes(
TipLengthCalibrationResponseAttributes,
DeckCalibrationResponseAttributes,
PipetteOffsetCalibrationResponseAttributes,
LiveProtocolResponseAttributes,
]


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@
from .deck_calibration_session import DeckCalibrationSession # noqa: F401
from .pipette_offset_calibration import PipetteOffsetCalibrationSession # noqa: F401
from .base_session import BaseSession, SessionMetaData # noqa: F401
from .live_protocol.session import LiveProtocolSession # noqa: F401
Empty file.

This file was deleted.

This file was deleted.

58 changes: 30 additions & 28 deletions robot-server/tests/integration/test_session.tavern.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ marks:
stages:
- name: Create a session
request:
url: "{host:s}:{port:d}/sessions"
url: '{host:s}:{port:d}/sessions'
method: POST
json:
data:
Expand All @@ -19,21 +19,21 @@ stages:

- name: Get the session
request:
url: "{host:s}:{port:d}/sessions/{session_id}"
url: '{host:s}:{port:d}/sessions/{session_id}'
method: GET
response:
status_code: 200

- name: Delete the session
request:
url: "{host:s}:{port:d}/sessions/{session_id}"
url: '{host:s}:{port:d}/sessions/{session_id}'
method: DELETE
response:
status_code: 200

- name: Fail to get the deleted session
request:
url: "{host:s}:{port:d}/sessions/{session_id}"
url: '{host:s}:{port:d}/sessions/{session_id}'
method: GET
response:
status_code: 404
Expand All @@ -44,13 +44,15 @@ marks:
- usefixtures:
- run_server
stages:
- name: Create a live protocol session
- name: Create a pipette offset calibration session
request:
url: "{host:s}:{port:d}/sessions"
url: '{host:s}:{port:d}/sessions'
method: POST
json:
data:
sessionType: "liveProtocol"
sessionType: 'pipetteOffsetCalibration'
createParams:
mount: 'right'
response:
status_code: 201
save:
Expand All @@ -59,7 +61,7 @@ stages:

- name: Create a deck cal session
request:
url: "{host:s}:{port:d}/sessions"
url: '{host:s}:{port:d}/sessions'
method: POST
json:
data:
Expand All @@ -72,56 +74,56 @@ stages:

- name: Get all the sessions
request:
url: "{host:s}:{port:d}/sessions"
url: '{host:s}:{port:d}/sessions'
method: GET
response:
status_code: 200
json:
links: null
data:
- id: "{session_id_1}"
sessionType: "liveProtocol"
createdAt: !re_search "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d+\\+\\d{2}:\\d{2}$"
details: {}
createParams: null
- id: "{session_id_2}"
sessionType: "deckCalibration"
createdAt: !re_search "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d+\\+\\d{2}:\\d{2}$"
details: !anydict
createParams: null
- id: '{session_id_1}'
sessionType: 'pipetteOffsetCalibration'
createdAt: !re_search "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d+\\+\\d{2}:\\d{2}$"
details: !anydict
createParams: !anydict
- id: '{session_id_2}'
sessionType: 'deckCalibration'
createdAt: !re_search "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d+\\+\\d{2}:\\d{2}$"
details: !anydict
createParams: null

- name: Get just the deck cal sessions
request:
url: "{host:s}:{port:d}/sessions?session_type=deckCalibration"
url: '{host:s}:{port:d}/sessions?session_type=deckCalibration'
method: GET
response:
status_code: 200
json:
links: null
data:
- id: "{session_id_2}"
sessionType: "deckCalibration"
createdAt: !re_search "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d+\\+\\d{2}:\\d{2}$"
details: !anydict
createParams: null
- id: '{session_id_2}'
sessionType: 'deckCalibration'
createdAt: !re_search "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d+\\+\\d{2}:\\d{2}$"
details: !anydict
createParams: null

- name: Delete session 1
request:
url: "{host:s}:{port:d}/sessions/{session_id_1}"
url: '{host:s}:{port:d}/sessions/{session_id_1}'
method: DELETE
response:
status_code: 200

- name: Delete session 2
request:
url: "{host:s}:{port:d}/sessions/{session_id_2}"
url: '{host:s}:{port:d}/sessions/{session_id_2}'
method: DELETE
response:
status_code: 200

- name: Get all the sessions and there are none
request:
url: "{host:s}:{port:d}/sessions"
url: '{host:s}:{port:d}/sessions'
method: GET
response:
status_code: 200
Expand Down
Empty file.
Empty file.
Loading

0 comments on commit 4b958e7

Please sign in to comment.