Skip to content

Commit

Permalink
Adding few restAPIs for deployer
Browse files Browse the repository at this point in the history
This pr adds restAPIs for the deployer to be able to exchange information with the controller.

Updated PR after ML comments

Updates to add_compute_apis pr

Updates to fix lint errors

Minor updates
  • Loading branch information
dhruvsgarg committed Jul 21, 2022
1 parent 0d0ac61 commit c1397c8
Show file tree
Hide file tree
Showing 16 changed files with 1,084 additions and 44 deletions.
222 changes: 211 additions & 11 deletions api/computes_api.partials.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
$ref: '#/components/schemas/Error'
description: unexpected error

/computes/{compute}:
/computes/{computeId}:
########################################
# Get the status of a compute cluster
########################################
Expand All @@ -50,8 +50,8 @@
tags:
- computes
parameters:
- name: compute
description: deployer id of compute cluster
- name: computeId
description: compute id of compute cluster
in: path
schema:
type: string
Expand Down Expand Up @@ -81,8 +81,8 @@
tags:
- computes
parameters:
- name: compute
description: deployer id of compute cluster
- name: computeId
description: compute id of compute cluster
in: path
schema:
type: string
Expand Down Expand Up @@ -115,8 +115,8 @@
tags:
- computes
parameters:
- name: compute
description: deployer id of compute cluster
- name: computeId
description: compute id of compute cluster
in: path
schema:
type: string
Expand All @@ -127,7 +127,7 @@
'200':
description: Deleted
'404':
description: Deployer id not found
description: compute id not found
'401':
description: Unauthorized
default:
Expand All @@ -137,7 +137,7 @@
$ref: '#/components/schemas/Error'
description: unexpected error

/computes/{compute}/config:
/computes/{computeId}/config:
########################################
# Get configuration of a compute cluster
########################################
Expand All @@ -147,8 +147,8 @@
tags:
- computes
parameters:
- name: compute
description: deployer id of compute cluster
- name: computeId
description: compute id of compute cluster
in: path
schema:
type: string
Expand All @@ -162,6 +162,206 @@
schema:
$ref: '#/components/schemas/ComputeSpec'
description: Information about compute cluster
default:
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
description: unexpected error

/computes/{computeId}/deployments:
########################################
# Get all deployments within a compute cluster
########################################
get:
operationId: getDeployments
summary: Get all deployments within a compute cluster
tags:
- computes
parameters:
- name: computeId
description: compute id of compute cluster
in: path
schema:
type: string
style: simple
explode: false
required: true
responses:
"200":
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/DeploymentStatus'
description: An array of status of all deployments in a compute cluster
default:
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
description: unexpected error

/computes/{computeId}/deployments/{jobId}/config:
########################################
# Get the deployment config for a job for a compute cluster
########################################
get:
operationId: getDeploymentConfig
summary: Get the deployment config for a job for a compute cluster
tags:
- computes
parameters:
- name: computeId
description: compute id of compute cluster
in: path
schema:
type: string
style: simple
explode: false
required: true
- name: jobId
description: job id
in: path
schema:
type: string
style: simple
explode: false
required: true
responses:
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/DeploymentConfig'
description: Get deployment configs for a job deployment
default:
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
description: unexpected error

/computes/{computeId}/deployments/{jobId}/status:
########################################
# Send the deployment status for a job on a compute cluster
########################################
post:
operationId: addDeploymentStatus
summary: Add the deployment status for a job on a compute cluster
tags:
- computes
parameters:
- name: computeId
description: compute id of compute cluster
in: path
schema:
type: string
style: simple
explode: false
required: true
- name: jobId
description: job id
in: path
schema:
type: string
style: simple
explode: false
required: true
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/DeploymentStatus'
description: Status for agents in a job deployment
responses:
"200":
description: Added deployment status
'401':
description: Unauthorized
default:
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
description: unexpected error

########################################
# Update the deployment status for a job on a compute cluster
########################################
put:
operationId: updateDeploymentStatus
summary: Update the deployment status for a job on a compute cluster
tags:
- computes
parameters:
- name: computeId
description: compute id of compute cluster
in: path
schema:
type: string
style: simple
explode: false
required: true
- name: jobId
description: job id
in: path
schema:
type: string
style: simple
explode: false
required: true
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/DeploymentStatus'
description: Status for agents in a job deployment
responses:
"200":
description: Updated the deployment status
'401':
description: Unauthorized
default:
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
description: unexpected error

########################################
# Get the deployment status for a job on a compute cluster
########################################
get:
operationId: getDeploymentStatus
summary: Get the deployment status for a job on a compute cluster
tags:
- computes
parameters:
- name: computeId
description: compute id of compute cluster
in: path
schema:
type: string
style: simple
explode: false
required: true
- name: jobId
description: job id
in: path
schema:
type: string
style: simple
explode: false
required: true
responses:
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/DeploymentStatus'
description: Status for agents in a job deployment
default:
content:
application/json:
Expand Down
84 changes: 83 additions & 1 deletion api/computes_components.partials.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,86 @@ ComputeState:
enum:
- up
- down
- maintenance
- maintenance

########################################
# Deployment config for agents
########################################
DeploymentConfig:
description: Deployment config for agents
type: object
properties:
jobId:
type: string
imageLoc:
type: string
agentKVs:
type: array
items:
$ref: '#/components/schemas/AgentKV'
required:
- jobId
- imageLoc
- agentKVs

########################################
# Config for agents in the deployment
########################################
AgentKV:
description: Config for agents in the deployment
type: object
properties:
taskId:
type: object
additionalProperties:
type: object
properties:
taskKey:
type: string
required:
- taskId

########################################
# Deployment status within a compute cluster
########################################
DeploymentStatus:
description: Deployment status within a compute cluster
type: object
properties:
jobId:
type: object
additionalProperties:
type: object
properties:
agents:
type: array
items:
$ref: '#/components/schemas/AgentStatus'
required:
- jobId

########################################
# Status for an agent within a deployment
########################################
AgentStatus:
description: Status for an agent within a deployment
type: object
properties:
taskId:
type: object
additionalProperties:
type: object
properties:
state:
$ref: '#/components/schemas/AgentState'
required:
- taskId

########################################
# Agent state
########################################
AgentState:
enum:
- deployed
- revoked
- error
Loading

0 comments on commit c1397c8

Please sign in to comment.