Skip to content

Latest commit

 

History

History
564 lines (458 loc) · 13.8 KB

Api.md

File metadata and controls

564 lines (458 loc) · 13.8 KB

Bill API v0.2.0

Meta Data

  • Usage Type

    name desc
    cpu The usage of CPU, unit m
    mem The usage of memory, unit Mi
    gpu The usage of GPU, unit number
    npu The usage of NPU, unit number

Bills

Get Bill List

GET /api/Bills

Code samples

curl -X GET /api/Bills \
  -H 'Accept: text/plain'

Parameters

Name In Type Required Description
userId query string(uuid) false User Id
type query string false Usage Type like cpu, mem, gpu, npu etc.

Responses

Status Meaning Description Schema
200 OK Returns the bill list Inline

Response Schema

Status Code 200

Name Type Required Restrictions Description
anonymous [BillItem] false none none
» id string(uuid) false none Bill Id
» startTime string(date-time) false none Start time, utc format
» endTime string(date-time) false none End time, utc format
» jobId string¦null false none Job Id
» jobName string¦null false none Job name
» userId string(uuid) false none User Id
» username string¦null false none Username
» vcName string¦null false none The name of virtual cluster
» type string¦null false none Usage type, cpu, mem, gpu, npu
» node string¦null false none The IP of the node where job runs on
» device string¦null false none Device model
» quota number(double) false none Device quota, CPU unit - m, Memory unit - Mi, GPU/NPU unit - number
» usage number(double) false none Sum of the resource usage, using hour as unit
» fee number(double) false none Fee
» isRunning boolean false none Whether the job is still running
This operation does not require authentication now

Ratios

Get Ratio List

GET /api/Ratios

Code samples

curl -X GET /api/Ratios \
  -H 'Accept: text/plain'

Responses

Status Meaning Description Schema
200 OK Success Inline

Response Schema

Status Code 200

Name Type Required Restrictions Description
anonymous [RatioInfo] false none none
» key string¦null false none Metrics or usage Type
» value number(double) false none The ratio value
This operation does not require authentication now

Create Ratio

POST /api/Ratios

Code samples

curl -X POST /api/Ratios \
  -H 'Content-Type: application/json'

Body parameter

{
  "type": "object",
  "properties": {
    "key": {
      "type": "string",
      "description": "Metrics or usage Type",
      "nullable": true
    },
    "value": {
      "type": "number",
      "description": "The ratio value",
      "format": "double"
    }
  },
  "additionalProperties": false
}

Parameters

Name In Type Required Description
body body RatioInfo false The ratio form

Responses

Status Meaning Description Schema
200 OK Success None
This operation does not require authentication now

Delete Ratio

DELETE /api/Ratios/{key}

Code samples

curl -X DELETE /api/Ratios/{key} \
  -H 'Accept: text/plain'

Parameters

Name In Type Required Description
key path string true Metrics or usage Type

Responses

Status Meaning Description Schema
204 No Content Success None
404 Not Found Not Found string
This operation does not require authentication now

Usages

Get Usage List

GET /api/Usages

Code samples

curl -X GET /api/Usages \
  -H 'Accept: text/plain'

Parameters

Name In Type Required Description
userId query string(uuid) false User Id
type query string false Usage Type like cpu, mem, gpu, npu etc.

Responses

Status Meaning Description Schema
200 OK Returns the usage list Inline

Response Schema

Status Code 200

Name Type Required Restrictions Description
anonymous [UsageItem] false none none
» id string(uuid) false none Usage Id
» startTime string(date-time) false none Start time, utc format
» endTime string(date-time) false none End time, utc format
» jobId string¦null false none Job Id
» jobName string¦null false none Job Name
» userId string(uuid) false none User Id
» username string¦null false none Username
» vcName string¦null false none The name of virtual cluster
» type string¦null false none Usage Type, cpu, mem, gpu, npu
» node string¦null false none The IP of the node where job runs on
» device string¦null false none Device model
» quota number(double) false none Device quota, CPU unit - m, Memory unit - Mi, GPU/NPU unit - number
» usage number(double) false none Sum of the resource usage, using hour as unit
» isRunning boolean false none Whether the job is still running
This operation does not require authentication now

Users

Get User List

GET /api/Users

Code samples

curl -X GET /api/Users \
  -H 'Accept: text/plain'

Responses

Status Meaning Description Schema
200 OK Returns the user list Inline

Response Schema

Status Code 200

Name Type Required Restrictions Description
anonymous [UserItem] false none none
» id string(uuid) false none none
» userName string¦null false none none
This operation does not require authentication now

Schemas

BillItem

{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Bill Id",
      "format": "uuid"
    },
    "startTime": {
      "type": "string",
      "description": "Start time, utc format",
      "format": "date-time"
    },
    "endTime": {
      "type": "string",
      "description": "End time, utc format",
      "format": "date-time"
    },
    "jobId": {
      "type": "string",
      "description": "Job Id",
      "nullable": true
    },
    "jobName": {
      "type": "string",
      "description": "Job name",
      "nullable": true
    },
    "userId": {
      "type": "string",
      "description": "User Id",
      "format": "uuid"
    },
    "username": {
      "type": "string",
      "description": "Username",
      "nullable": true
    },
    "vcName": {
      "type": "string",
      "description": "The name of virtual cluster",
      "nullable": true
    },
    "type": {
      "type": "string",
      "description": "Usage type, cpu, mem, gpu, npu",
      "nullable": true
    },
    "node": {
      "type": "string",
      "description": "The IP of the node where job runs on",
      "nullable": true
    },
    "device": {
      "type": "string",
      "description": "Device model",
      "nullable": true
    },
    "quota": {
      "type": "number",
      "description": "Device quota, CPU unit - m, Memory unit - Mi, GPU/NPU unit - number",
      "format": "double"
    },
    "usage": {
      "type": "number",
      "description": "Sum of the resource usage, using hour as unit",
      "format": "double"
    },
    "fee": {
      "type": "number",
      "description": "Fee",
      "format": "double"
    },
    "isRunning": {
      "type": "boolean",
      "description": "Whether the job is still running"
    }
  },
  "additionalProperties": false
}

Properties

Name Type Required Restrictions Description
id string(uuid) false none Bill Id
startTime string(date-time) false none Start time, utc format
endTime string(date-time) false none End time, utc format
jobId string¦null false none Job Id
jobName string¦null false none Job name
userId string(uuid) false none User Id
username string¦null false none Username
vcName string¦null false none The name of virtual cluster
type string¦null false none Usage type, cpu, mem, gpu, npu
node string¦null false none The IP of the node where job runs on
device string¦null false none Device model
quota number(double) false none Device quota, CPU unit - m, Memory unit - Mi, GPU/NPU unit - number
usage number(double) false none Sum of the resource usage, using hour as unit
fee number(double) false none Fee
isRunning boolean false none Whether the job is still running

RatioInfo

{
  "type": "object",
  "properties": {
    "key": {
      "type": "string",
      "description": "Metrics or usage Type",
      "nullable": true
    },
    "value": {
      "type": "number",
      "description": "The ratio value",
      "format": "double"
    }
  },
  "additionalProperties": false
}

Properties

Name Type Required Restrictions Description
key string¦null false none Metrics or usage Type
value number(double) false none The ratio value

UsageItem

{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Usage Id",
      "format": "uuid"
    },
    "startTime": {
      "type": "string",
      "description": "Start time, utc format",
      "format": "date-time"
    },
    "endTime": {
      "type": "string",
      "description": "End time, utc format",
      "format": "date-time"
    },
    "jobId": {
      "type": "string",
      "description": "Job Id",
      "nullable": true
    },
    "jobName": {
      "type": "string",
      "description": "Job Name",
      "nullable": true
    },
    "userId": {
      "type": "string",
      "description": "User Id",
      "format": "uuid"
    },
    "username": {
      "type": "string",
      "description": "Username",
      "nullable": true
    },
    "vcName": {
      "type": "string",
      "description": "The name of virtual cluster",
      "nullable": true
    },
    "type": {
      "type": "string",
      "description": "Usage Type, cpu, mem, gpu, npu",
      "nullable": true
    },
    "node": {
      "type": "string",
      "description": "The IP of the node where job runs on",
      "nullable": true
    },
    "device": {
      "type": "string",
      "description": "Device model",
      "nullable": true
    },
    "quota": {
      "type": "number",
      "description": "Device quota, CPU unit - m, Memory unit - Mi, GPU/NPU unit - number",
      "format": "double"
    },
    "usage": {
      "type": "number",
      "description": "Sum of the resource usage, using hour as unit",
      "format": "double"
    },
    "isRunning": {
      "type": "boolean",
      "description": "Whether the job is still running"
    }
  },
  "additionalProperties": false
}

Properties

Name Type Required Restrictions Description
id string(uuid) false none Usage Id
startTime string(date-time) false none Start time, utc format
endTime string(date-time) false none End time, utc format
jobId string¦null false none Job Id
jobName string¦null false none Job Name
userId string(uuid) false none User Id
username string¦null false none Username
vcName string¦null false none The name of virtual cluster
type string¦null false none Usage Type, cpu, mem, gpu, npu
node string¦null false none The IP of the node where job runs on
device string¦null false none Device model
quota number(double) false none Device quota, CPU unit - m, Memory unit - Mi, GPU/NPU unit - number
usage number(double) false none Sum of the resource usage, using hour as unit
isRunning boolean false none Whether the job is still running

UserItem

{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "userName": {
      "type": "string",
      "nullable": true
    }
  },
  "additionalProperties": false
}

Properties

Name Type Required Restrictions Description
id string(uuid) false none none
userName string¦null false none none