Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remote-run api implementation #4022

Merged
merged 7 commits into from
Mar 24, 2025
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
20 changes: 20 additions & 0 deletions paasta_tools/api/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,26 @@ def make_app(global_config=None):
"/v1/service_autoscaler/pause",
request_method="GET",
)
config.add_route(
"remote_run.start",
"/v1/remote_run/{service}/{instance}/start",
request_method="POST",
)
config.add_route(
"remote_run.stop",
"/v1/remote_run/{service}/{instance}/stop",
request_method="POST",
)
config.add_route(
"remote_run.poll",
"/v1/remote_run/{service}/{instance}/poll",
request_method="GET",
)
config.add_route(
"remote_run.token",
"/v1/remote_run/{service}/{instance}/token",
request_method="GET",
)
config.add_route("version", "/v1/version")
config.add_route("deploy_queue.list", "/v1/deploy_queue")
config.scan()
Expand Down
189 changes: 188 additions & 1 deletion paasta_tools/api/api_docs/oapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
openapi: 3.0.0
info:
title: Paasta API
version: 1.0.0
version: 1.1.0
servers:
- url: "{scheme}://{host}/{basePath}"
variables:
Expand Down Expand Up @@ -893,6 +893,49 @@ components:
description: Kubernetes namespace this version is in
type: string
type: object
RemoteRunStart:
type: object
properties:
interactive:
type: boolean
recreate:
type: boolean
user:
type: string
max_duration:
type: integer
required:
- user
RemoteRunStop:
type: object
properties:
user:
type: string
required:
- user
RemoteRunOutcome:
type: object
properties:
status:
type: integer
message:
type: string
pod_name:
type: string
job_name:
type: string
namespace:
type: string
required:
- status
- message
RemoteRunToken:
type: object
properties:
token:
type: string
required:
- token
Resource:
items:
$ref: '#/components/schemas/ResourceItem'
Expand Down Expand Up @@ -1141,6 +1184,150 @@ paths:
summary: Get overview of a flink cluster
tags:
- service
/remote_run/{service}/{instance}/start:
post:
operationId: remote_run_start
summary: Launch a remote-run pod
tags:
- remote_run
parameters:
- description: Service name
in: path
name: service
required: true
schema:
type: string
- description: Instance name
in: path
name: instance
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/RemoteRunStart'
required: true
responses:
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/RemoteRunOutcome'
description: Successfully started remote-run sandbox
"404":
description: Service instance not found
"500":
description: Failure
/remote_run/{service}/{instance}/stop:
post:
operationId: remote_run_stop
summary: Stop a remote-run pod
tags:
- remote_run
parameters:
- description: Service name
in: path
name: service
required: true
schema:
type: string
- description: Instance name
in: path
name: instance
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/RemoteRunStop'
required: true
responses:
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/RemoteRunOutcome'
description: Remote run pod stopped
"404":
description: Service instance not found
"500":
description: Failure
/remote_run/{service}/{instance}/poll:
get:
operationId: remote_run_poll
summary: Check if remote run pod is ready
tags:
- remote_run
parameters:
- description: Service name
in: path
name: service
required: true
schema:
type: string
- description: Instance name
in: path
name: instance
required: true
schema:
type: string
- description: Job name
in: query
name: job_name
schema:
type: string
required: true
responses:
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/RemoteRunOutcome'
description: Pod status information
"404":
description: Service instance not found
"500":
description: Failure
/remote_run/{service}/{instance}/token:
get:
operationId: remote_run_token
summary: Get a short lived token for exec into remote-run pod
tags:
- remote_run
parameters:
- description: Service name
in: path
name: service
required: true
schema:
type: string
- description: Instance name
in: path
name: instance
required: true
schema:
type: string
- description: User name
in: query
name: user
schema:
type: string
required: true
responses:
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/RemoteRunToken'
description: Token generated successfully
"404":
description: Service instance not found
"500":
description: Failure
/resources/utilization:
get:
operationId: resources
Expand Down
Loading
Loading