Skip to content
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

docs(robot-server): Correct and unify the definition of "current" #15223

Merged
merged 3 commits into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -520,6 +520,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 @@ -373,7 +373,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
Loading