Skip to content

Commit

Permalink
docs(robot-server): Correct and unify the definition of "current" (#1…
Browse files Browse the repository at this point in the history
  • Loading branch information
SyntaxColoring authored and Carlos-fernandez committed Jun 3, 2024
1 parent f4df359 commit 3b18116
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
2 changes: 2 additions & 0 deletions api/src/opentrons/protocol_engine/state/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,8 @@ def get_slice(
queued_command_ids = self._state.command_history.get_queue_ids()
total_length = self._state.command_history.length()

# TODO(mm, 2024-05-17): This looks like it's attempting to do the same thing
# as self.get_current(), but in a different way. Can we unify them?
if cursor is None:
if running_command is not None:
cursor = running_command.index
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,10 @@ def get_commands_slice(
return the_slice

def get_current_command(self, run_id: str) -> Optional[CurrentCommand]:
"""Get the currently executing command, if any.
"""Get the "current" command, if any.
See `ProtocolEngine.state_view.commands.get_current()` for the definition
of "current."
Args:
run_id: ID of the run.
Expand Down
6 changes: 5 additions & 1 deletion robot-server/robot_server/runs/command_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,9 @@ class CommandCollectionLinks(BaseModel):

current: Optional[CommandLink] = Field(
None,
description="Path to the currently running or next queued command.",
description=(
'Information about the "current" command.'
' The "current" command is the one that\'s running right now,'
" or, if there is none, the one that was running most recently."
),
)
5 changes: 4 additions & 1 deletion robot-server/robot_server/runs/run_data_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,10 @@ def get_commands_slice(
)

def get_current_command(self, run_id: str) -> Optional[CurrentCommand]:
"""Get the currently executing command, if any.
"""Get the "current" command, if any.
See `ProtocolEngine.state_view.commands.get_current()` for the definition
of "current."
Args:
run_id: ID of the run.
Expand Down

0 comments on commit 3b18116

Please sign in to comment.