Skip to content
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: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 44
configured_endpoints: 46
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai%2Frunloop-15f23a9e2e014d2e5d4d72c39ee31c5556060fb37d1490f308ecce5aeb41d5c8.yml
2 changes: 2 additions & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,10 @@ Methods:

Methods:

- <code title="get /v1/devboxes/{devbox_id}/executions/{execution_id}">client.devboxes.executions.<a href="./src/runloop_api_client/resources/devboxes/executions.py">retrieve</a>(execution_id, \*, devbox_id, \*\*<a href="src/runloop_api_client/types/devboxes/execution_retrieve_params.py">params</a>) -> <a href="./src/runloop_api_client/types/devbox_async_execution_detail_view.py">DevboxAsyncExecutionDetailView</a></code>
- <code title="post /v1/devboxes/{id}/execute_async">client.devboxes.executions.<a href="./src/runloop_api_client/resources/devboxes/executions.py">execute_async</a>(id, \*\*<a href="src/runloop_api_client/types/devboxes/execution_execute_async_params.py">params</a>) -> <a href="./src/runloop_api_client/types/devbox_async_execution_detail_view.py">DevboxAsyncExecutionDetailView</a></code>
- <code title="post /v1/devboxes/{id}/execute_sync">client.devboxes.executions.<a href="./src/runloop_api_client/resources/devboxes/executions.py">execute_sync</a>(id, \*\*<a href="src/runloop_api_client/types/devboxes/execution_execute_sync_params.py">params</a>) -> <a href="./src/runloop_api_client/types/devbox_execution_detail_view.py">DevboxExecutionDetailView</a></code>
- <code title="post /v1/devboxes/{devbox_id}/executions/{execution_id}/kill">client.devboxes.executions.<a href="./src/runloop_api_client/resources/devboxes/executions.py">kill</a>(execution_id, \*, devbox_id) -> <a href="./src/runloop_api_client/types/devbox_async_execution_detail_view.py">DevboxAsyncExecutionDetailView</a></code>

# Repositories

Expand Down
204 changes: 203 additions & 1 deletion src/runloop_api_client/resources/devboxes/executions.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
async_to_streamed_response_wrapper,
)
from ..._base_client import make_request_options
from ...types.devboxes import execution_execute_sync_params, execution_execute_async_params
from ...types.devboxes import execution_retrieve_params, execution_execute_sync_params, execution_execute_async_params
from ...types.devbox_execution_detail_view import DevboxExecutionDetailView
from ...types.devbox_async_execution_detail_view import DevboxAsyncExecutionDetailView

Expand All @@ -47,6 +47,50 @@ def with_streaming_response(self) -> ExecutionsResourceWithStreamingResponse:
"""
return ExecutionsResourceWithStreamingResponse(self)

def retrieve(
self,
execution_id: str,
*,
devbox_id: str,
last_n: str | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> DevboxAsyncExecutionDetailView:
"""
Get the latest status of a previously launched asynchronous execuction including
stdout/error and the exit code if complete.

Args:
last_n: Last n lines of standard error / standard out to return

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds
"""
if not devbox_id:
raise ValueError(f"Expected a non-empty value for `devbox_id` but received {devbox_id!r}")
if not execution_id:
raise ValueError(f"Expected a non-empty value for `execution_id` but received {execution_id!r}")
return self._get(
f"/v1/devboxes/{devbox_id}/executions/{execution_id}",
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
query=maybe_transform({"last_n": last_n}, execution_retrieve_params.ExecutionRetrieveParams),
),
cast_to=DevboxAsyncExecutionDetailView,
)

def execute_async(
self,
id: str,
Expand Down Expand Up @@ -165,6 +209,50 @@ def execute_sync(
cast_to=DevboxExecutionDetailView,
)

def kill(
self,
execution_id: str,
*,
devbox_id: str,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
idempotency_key: str | None = None,
) -> DevboxAsyncExecutionDetailView:
"""
Kill a previously launched asynchronous execution if it is still running by
killing the launched process.

Args:
extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds

idempotency_key: Specify a custom idempotency key for this request
"""
if not devbox_id:
raise ValueError(f"Expected a non-empty value for `devbox_id` but received {devbox_id!r}")
if not execution_id:
raise ValueError(f"Expected a non-empty value for `execution_id` but received {execution_id!r}")
return self._post(
f"/v1/devboxes/{devbox_id}/executions/{execution_id}/kill",
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
idempotency_key=idempotency_key,
),
cast_to=DevboxAsyncExecutionDetailView,
)


class AsyncExecutionsResource(AsyncAPIResource):
@cached_property
Expand All @@ -186,6 +274,52 @@ def with_streaming_response(self) -> AsyncExecutionsResourceWithStreamingRespons
"""
return AsyncExecutionsResourceWithStreamingResponse(self)

async def retrieve(
self,
execution_id: str,
*,
devbox_id: str,
last_n: str | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> DevboxAsyncExecutionDetailView:
"""
Get the latest status of a previously launched asynchronous execuction including
stdout/error and the exit code if complete.

Args:
last_n: Last n lines of standard error / standard out to return

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds
"""
if not devbox_id:
raise ValueError(f"Expected a non-empty value for `devbox_id` but received {devbox_id!r}")
if not execution_id:
raise ValueError(f"Expected a non-empty value for `execution_id` but received {execution_id!r}")
return await self._get(
f"/v1/devboxes/{devbox_id}/executions/{execution_id}",
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
query=await async_maybe_transform(
{"last_n": last_n}, execution_retrieve_params.ExecutionRetrieveParams
),
),
cast_to=DevboxAsyncExecutionDetailView,
)

async def execute_async(
self,
id: str,
Expand Down Expand Up @@ -304,50 +438,118 @@ async def execute_sync(
cast_to=DevboxExecutionDetailView,
)

async def kill(
self,
execution_id: str,
*,
devbox_id: str,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
idempotency_key: str | None = None,
) -> DevboxAsyncExecutionDetailView:
"""
Kill a previously launched asynchronous execution if it is still running by
killing the launched process.

Args:
extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds

idempotency_key: Specify a custom idempotency key for this request
"""
if not devbox_id:
raise ValueError(f"Expected a non-empty value for `devbox_id` but received {devbox_id!r}")
if not execution_id:
raise ValueError(f"Expected a non-empty value for `execution_id` but received {execution_id!r}")
return await self._post(
f"/v1/devboxes/{devbox_id}/executions/{execution_id}/kill",
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
idempotency_key=idempotency_key,
),
cast_to=DevboxAsyncExecutionDetailView,
)


class ExecutionsResourceWithRawResponse:
def __init__(self, executions: ExecutionsResource) -> None:
self._executions = executions

self.retrieve = to_raw_response_wrapper(
executions.retrieve,
)
self.execute_async = to_raw_response_wrapper(
executions.execute_async,
)
self.execute_sync = to_raw_response_wrapper(
executions.execute_sync,
)
self.kill = to_raw_response_wrapper(
executions.kill,
)


class AsyncExecutionsResourceWithRawResponse:
def __init__(self, executions: AsyncExecutionsResource) -> None:
self._executions = executions

self.retrieve = async_to_raw_response_wrapper(
executions.retrieve,
)
self.execute_async = async_to_raw_response_wrapper(
executions.execute_async,
)
self.execute_sync = async_to_raw_response_wrapper(
executions.execute_sync,
)
self.kill = async_to_raw_response_wrapper(
executions.kill,
)


class ExecutionsResourceWithStreamingResponse:
def __init__(self, executions: ExecutionsResource) -> None:
self._executions = executions

self.retrieve = to_streamed_response_wrapper(
executions.retrieve,
)
self.execute_async = to_streamed_response_wrapper(
executions.execute_async,
)
self.execute_sync = to_streamed_response_wrapper(
executions.execute_sync,
)
self.kill = to_streamed_response_wrapper(
executions.kill,
)


class AsyncExecutionsResourceWithStreamingResponse:
def __init__(self, executions: AsyncExecutionsResource) -> None:
self._executions = executions

self.retrieve = async_to_streamed_response_wrapper(
executions.retrieve,
)
self.execute_async = async_to_streamed_response_wrapper(
executions.execute_async,
)
self.execute_sync = async_to_streamed_response_wrapper(
executions.execute_sync,
)
self.kill = async_to_streamed_response_wrapper(
executions.kill,
)
1 change: 1 addition & 0 deletions src/runloop_api_client/types/devboxes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
from .code_action_trigger_kind import CodeActionTriggerKind as CodeActionTriggerKind
from .base_workspace_edit_param import BaseWorkspaceEditParam as BaseWorkspaceEditParam
from .code_action_context_param import CodeActionContextParam as CodeActionContextParam
from .execution_retrieve_params import ExecutionRetrieveParams as ExecutionRetrieveParams
from .base_parameter_information import BaseParameterInformation as BaseParameterInformation
from .code_segment_info_response import CodeSegmentInfoResponse as CodeSegmentInfoResponse
from .lsp_file_definition_params import LspFileDefinitionParams as LspFileDefinitionParams
Expand Down
14 changes: 14 additions & 0 deletions src/runloop_api_client/types/devboxes/execution_retrieve_params.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from __future__ import annotations

from typing_extensions import Required, TypedDict

__all__ = ["ExecutionRetrieveParams"]


class ExecutionRetrieveParams(TypedDict, total=False):
devbox_id: Required[str]

last_n: str
"""Last n lines of standard error / standard out to return"""
Loading