Skip to content

Commit a8c6138

Browse files
authored
update execute_and_await_completion params (#668)
* add new exec parameters to exec and await completed * expose command_id as a parameter to exec and await completion * added comment explaining command_id use and generation in docstring
1 parent 6ef7b34 commit a8c6138

1 file changed

Lines changed: 18 additions & 4 deletions

File tree

src/runloop_api_client/resources/devboxes/devboxes.py

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -802,6 +802,9 @@ def execute_and_await_completion(
802802
devbox_id: str,
803803
*,
804804
command: str,
805+
command_id: str = str(uuid7()),
806+
last_n: str | Omit = omit,
807+
optimistic_timeout: Optional[int] | Omit = omit,
805808
shell_name: Optional[str] | Omit = omit,
806809
polling_config: PollingConfig | None = None,
807810
# The following are forwarded to the initial execute request
@@ -814,15 +817,19 @@ def execute_and_await_completion(
814817
"""
815818
Execute a command and wait for it to complete with optimal latency for long running commands.
816819
817-
This method launches an execution with a generated command_id and first attempts to
820+
This method launches an execution and first attempts to
818821
return the result within the initial request's timeout. If the execution is not yet
819822
complete, it switches to using wait_for_command to minimize latency while waiting.
823+
824+
A command_id (UUIDv7) is automatically generated for idempotency and tracking.
825+
You can provide your own command_id to enable custom retry logic or external tracking.
820826
"""
821-
command_id = str(uuid7()) # type: ignore
822827
execution = self.execute(
823828
devbox_id,
824829
command=command,
825830
command_id=command_id,
831+
last_n=last_n,
832+
optimistic_timeout=optimistic_timeout,
826833
shell_name=shell_name,
827834
extra_headers=extra_headers,
828835
extra_query=extra_query,
@@ -2284,6 +2291,9 @@ async def execute_and_await_completion(
22842291
devbox_id: str,
22852292
*,
22862293
command: str,
2294+
command_id: str = str(uuid7()),
2295+
last_n: str | Omit = omit,
2296+
optimistic_timeout: Optional[int] | Omit = omit,
22872297
shell_name: Optional[str] | Omit = omit,
22882298
polling_config: PollingConfig | None = None,
22892299
# The following are forwarded to the initial execute request
@@ -2296,16 +2306,20 @@ async def execute_and_await_completion(
22962306
"""
22972307
Execute a command and wait for it to complete with optimal latency for long running commands.
22982308
2299-
This method launches an execution with a generated command_id and first attempts to
2309+
This method launches an execution and first attempts to
23002310
return the result within the initial request's timeout. If the execution is not yet
23012311
complete, it switches to using wait_for_command to minimize latency while waiting.
2312+
2313+
A command_id (UUIDv7) is automatically generated for idempotency and tracking.
2314+
You can provide your own command_id to enable custom retry logic or external tracking.
23022315
"""
23032316

2304-
command_id = str(uuid7()) # type: ignore
23052317
execution = await self.execute(
23062318
devbox_id,
23072319
command=command,
23082320
command_id=command_id,
2321+
last_n=last_n,
2322+
optimistic_timeout=optimistic_timeout,
23092323
shell_name=shell_name,
23102324
extra_headers=extra_headers,
23112325
extra_query=extra_query,

0 commit comments

Comments
 (0)