Skip to content

Commit

Permalink
ActiveNozzleLayout.config is an enum now
Browse files Browse the repository at this point in the history
  • Loading branch information
mjhuff committed Oct 4, 2024
1 parent 377299e commit ab064fa
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
3 changes: 2 additions & 1 deletion robot-server/robot_server/runs/router/base_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
ActiveNozzleLayout,
RunCurrentState,
CommandLinkNoMeta,
NozzleLayoutConfig,
)
from ..run_auto_deleter import RunAutoDeleter
from ..run_models import Run, BadRun, RunCreate, RunUpdate
Expand Down Expand Up @@ -576,7 +577,7 @@ async def get_current_state(
pipetteId: ActiveNozzleLayout.construct(
startingNozzle=nozzle_map.starting_nozzle,
activeNozzles=list(nozzle_map.map_store.keys()),
config=nozzle_map.configuration.value,
config=NozzleLayoutConfig(nozzle_map.configuration.value.lower()),
)
for pipetteId, nozzle_map in active_nozzle_maps.items()
}
Expand Down
16 changes: 15 additions & 1 deletion robot-server/robot_server/runs/run_models.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"""Request and response models for run resources."""
from datetime import datetime

from enum import Enum
from pydantic import BaseModel, Field
from typing import List, Optional, Literal, Dict

Expand Down Expand Up @@ -280,6 +282,16 @@ class LabwareDefinitionSummary(BaseModel):
)


class NozzleLayoutConfig(str, Enum):
"""Possible valid nozzle configurations."""

COLUMN = "column"
ROW = "row"
SINGLE = "single"
FULL = "full"
SUBRECT = "subrect"


class ActiveNozzleLayout(BaseModel):
"""Details about the active nozzle layout for a pipette used in the current run."""

Expand All @@ -290,7 +302,9 @@ class ActiveNozzleLayout(BaseModel):
...,
description="A map of all the pipette nozzles active in the current configuration.",
)
config: str = Field(..., description="The nozzle configuration type.")
config: NozzleLayoutConfig = Field(
..., description="The active nozzle configuration."
)


class RunCurrentState(BaseModel):
Expand Down
5 changes: 4 additions & 1 deletion robot-server/tests/runs/router/test_base_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
RunCurrentState,
ActiveNozzleLayout,
CommandLinkNoMeta,
NozzleLayoutConfig,
)
from robot_server.runs.run_orchestrator_store import RunConflictError
from robot_server.runs.run_data_manager import (
Expand Down Expand Up @@ -868,7 +869,9 @@ async def test_get_current_state_success(
assert result.content.data == RunCurrentState.construct(
activeNozzleLayouts={
"mock-pipette-id": ActiveNozzleLayout(
startingNozzle="A1", activeNozzles=["A1"], config="FULL"
startingNozzle="A1",
activeNozzles=["A1"],
config=NozzleLayoutConfig.FULL,
)
}
)
Expand Down

0 comments on commit ab064fa

Please sign in to comment.