Skip to content
Merged
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
22 changes: 18 additions & 4 deletions src/runloop_api_client/resources/devboxes/devboxes.py
Original file line number Diff line number Diff line change
Expand Up @@ -802,6 +802,9 @@ def execute_and_await_completion(
devbox_id: str,
*,
command: str,
command_id: str = str(uuid7()),
last_n: str | Omit = omit,
optimistic_timeout: Optional[int] | Omit = omit,
shell_name: Optional[str] | Omit = omit,
polling_config: PollingConfig | None = None,
# The following are forwarded to the initial execute request
Expand All @@ -814,15 +817,19 @@ def execute_and_await_completion(
"""
Execute a command and wait for it to complete with optimal latency for long running commands.

This method launches an execution with a generated command_id and first attempts to
This method launches an execution and first attempts to
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe add a comment about how the command_id is generated unless the user wants to use a specific one. Then explain the purpose of command ID.

return the result within the initial request's timeout. If the execution is not yet
complete, it switches to using wait_for_command to minimize latency while waiting.

A command_id (UUIDv7) is automatically generated for idempotency and tracking.
You can provide your own command_id to enable custom retry logic or external tracking.
"""
command_id = str(uuid7()) # type: ignore
execution = self.execute(
devbox_id,
command=command,
command_id=command_id,
last_n=last_n,
optimistic_timeout=optimistic_timeout,
shell_name=shell_name,
extra_headers=extra_headers,
extra_query=extra_query,
Expand Down Expand Up @@ -2284,6 +2291,9 @@ async def execute_and_await_completion(
devbox_id: str,
*,
command: str,
command_id: str = str(uuid7()),
last_n: str | Omit = omit,
optimistic_timeout: Optional[int] | Omit = omit,
shell_name: Optional[str] | Omit = omit,
polling_config: PollingConfig | None = None,
# The following are forwarded to the initial execute request
Expand All @@ -2296,16 +2306,20 @@ async def execute_and_await_completion(
"""
Execute a command and wait for it to complete with optimal latency for long running commands.

This method launches an execution with a generated command_id and first attempts to
This method launches an execution and first attempts to
return the result within the initial request's timeout. If the execution is not yet
complete, it switches to using wait_for_command to minimize latency while waiting.

A command_id (UUIDv7) is automatically generated for idempotency and tracking.
You can provide your own command_id to enable custom retry logic or external tracking.
"""

command_id = str(uuid7()) # type: ignore
execution = await self.execute(
devbox_id,
command=command,
command_id=command_id,
last_n=last_n,
optimistic_timeout=optimistic_timeout,
shell_name=shell_name,
extra_headers=extra_headers,
extra_query=extra_query,
Expand Down