Skip to content

Commit

Permalink
Add async starlark logs
Browse files Browse the repository at this point in the history
  • Loading branch information
lostbean committed Nov 29, 2023
1 parent f46d4b9 commit ade15b7
Show file tree
Hide file tree
Showing 9 changed files with 557 additions and 229 deletions.
218 changes: 153 additions & 65 deletions api/golang/http_rest/api_types/api_types.gen.go

Large diffs are not rendered by default.

196 changes: 96 additions & 100 deletions api/golang/http_rest/core_rest_api/api_container_server.gen.go

Large diffs are not rendered by default.

58 changes: 47 additions & 11 deletions api/golang/http_rest/websocket_api/websocket_server.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 43 additions & 1 deletion api/openapi/specs/api_types.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ components:
description: The service identifier of the container that the command should be executed in
required: true

starlark_execution_uuid:
name: starlark_execution_uuid
in: path
schema:
type: string
description: The unique identifier to track the execution of a Starlark script or package
required: true

service_uuid_set:
name: service_uuid_set
in: query
Expand All @@ -49,6 +57,14 @@ components:
type: array
items:
type: string

retrieve_logs_async:
name: retrieve_logs_async
in: query
required: false
description: If false, block http response until all logs are available. Default is true
schema:
type: boolean

remove_all:
name: remove_all
Expand Down Expand Up @@ -537,6 +553,13 @@ components:
description: |-
0 - NO_INSTRUCTIONS_CACHING
StarlarkRunLogs:
type: array
items:
$ref: "#/components/schemas/StarlarkRunResponseLine"
description: |-
Starlark Execution Logs
StarlarkRunResponseLine:
oneOf:
- $ref: "#/components/schemas/StarlarkInstruction"
Expand Down Expand Up @@ -729,10 +752,29 @@ components:
type: string
required:
- is_run_successful
- serialized_output
required:
- run_finished_event

AsyncStarlarkExecutionLogs:
type: object
properties:
async_starlark_execution_logs:
type: object
properties:
starlark_execution_uuid:
type: string
description: Execution UUID to asynchronously retrieve the execution logs
required:
- starlark_execution_uuid
description: Use it to asynchronously retrieve the execution logs via Websockets or http streaming
required:
- async_starlark_execution_logs

StarlarkRunResponse:
oneOf:
- $ref: "#/components/schemas/AsyncStarlarkExecutionLogs"
- $ref: "#/components/schemas/StarlarkRunLogs"

ServiceIdentifiers:
type: object
properties:
Expand Down
18 changes: 4 additions & 14 deletions api/openapi/specs/core_service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ paths:
parameters:
- $ref: './api_types.yaml#/components/parameters/enclave_identifier'
- $ref: './api_types.yaml#/components/parameters/package_id'
- $ref: './api_types.yaml#/components/parameters/retrieve_logs_async'
requestBody:
content:
application/json:
Expand All @@ -53,21 +54,16 @@ paths:
"200":
description: Successful request
content:
application/octet-stream:
schema:
type: string
format: binary
application/json:
schema:
type: array
items:
$ref: "./api_types.yaml#/components/schemas/StarlarkRunResponseLine"
$ref: "./api_types.yaml#/components/schemas/StarlarkRunResponse"

/enclaves/{enclave_identifier}/starlark/scripts:
post:
description: Executes a Starlark script on the user's behalf
parameters:
- $ref: './api_types.yaml#/components/parameters/enclave_identifier'
- $ref: './api_types.yaml#/components/parameters/retrieve_logs_async'
requestBody:
content:
application/json:
Expand All @@ -80,15 +76,9 @@ paths:
"200":
description: Successful request
content:
application/octet-stream:
schema:
type: string
format: binary
application/json:
schema:
type: array
items:
$ref: "./api_types.yaml#/components/schemas/StarlarkRunResponseLine"
$ref: "./api_types.yaml#/components/schemas/StarlarkRunResponse"

/enclaves/{enclave_identifier}/services/{service_identifier}:
get:
Expand Down
30 changes: 30 additions & 0 deletions api/openapi/specs/websocket_service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,33 @@ paths:
application/json:
schema:
$ref: "./api_types.yaml#/components/schemas/ServiceLogs"

/enclaves/{enclave_identifier}/starlark/executions/{starlark_execution_uuid}/logs:
get:
description: Executes a Starlark script on the user's behalf
parameters:
- $ref: './api_types.yaml#/components/parameters/enclave_identifier'
- $ref: './api_types.yaml#/components/parameters/starlark_execution_uuid'
responses:
default:
$ref: '#/components/responses/NotOk'
"200":
description: Successful request
content:
application/json:
schema:
type: array
items:
$ref: "./api_types.yaml#/components/schemas/StarlarkRunResponseLine"

components:

responses:

NotOk:
description: Unexpected error
content:
application/json:
schema:
$ref: './api_types.yaml#/components/schemas/ResponseInfo'
required: true
Loading

0 comments on commit ade15b7

Please sign in to comment.