Skip to content

Commit

Permalink
Add recoveryTarget field.
Browse files Browse the repository at this point in the history
  • Loading branch information
SyntaxColoring committed May 16, 2024
1 parent a708a92 commit af5adef
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions robot-server/robot_server/runs/command_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"""

from datetime import datetime
from textwrap import dedent
from typing import Optional

from pydantic import BaseModel, Field
Expand All @@ -29,18 +30,17 @@ class CommandLinkMeta(BaseModel):

runId: str = Field(..., description="The ID of the command's run.")
commandId: str = Field(..., description="The ID of the command.")
index: int = Field(..., description="Index of the command in the overall list.")
key: str = Field(..., description="Value of the current command's `key` field.")
createdAt: datetime = Field(
...,
description="When the current command was created.",
index: int = Field(
..., description="The index of the command in the run's overall command list."
)
key: str = Field(..., description="The value of the command's `key` field.")
createdAt: datetime = Field(..., description="When the command was created.")


class CommandLink(BaseModel):
"""A link to a command resource."""

href: str = Field(..., description="The path to a command")
href: str = Field(..., description="The HTTP API path to the command")
meta: CommandLinkMeta = Field(..., description="Information about the command.")


Expand All @@ -49,5 +49,18 @@ class CommandCollectionLinks(BaseModel):

current: Optional[CommandLink] = Field(
None,
description="Path to the currently running or next queued command.",
description="Information about the currently running or next queued command.",
)

recoveryTarget: Optional[CommandLink] = Field(
None,
description=dedent(
"""\
Information about the command currently undergoing error recovery.
This is basically the most recent protocol command to have failed,
except that once you complete error recovery (see `GET /runs/{id}/actions`),
this goes back to being `null` or omitted.
"""
),
)

0 comments on commit af5adef

Please sign in to comment.