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

feat: add pagination get jobs #61

Merged
merged 14 commits into from
Dec 26, 2024
Merged
Show file tree
Hide file tree
Changes from 8 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
116 changes: 115 additions & 1 deletion backend/oas/provider/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,19 @@ paths:
schema:
type: string
example: Kawasaki
- in: query
name: fields
description: |-
Allows to specify an exact list of job properties to fetch for a single job. Each element of the list must be a valid name of job property.

If parameter is specified and requested job field is not defined for a job null is returned.

If parameter is omitted all available job properties are returned. Undefined job properties (null properties) are not included in the response.
required: false
schema:
type: string
maxLength: 1024
example: job_id,status,name
- in: query
name: status
description: Additional search parameter:<br/> Search jobs with specified status only
Expand All @@ -128,7 +141,7 @@ paths:
schema:
type: array
items:
$ref: '#/components/schemas/jobs.JobDef'
$ref: '#/components/schemas/jobs.GetJobsResponse'
'400':
description: Bad Request
content:
Expand Down Expand Up @@ -445,6 +458,107 @@ components:
description: The reason indicating why there is no result
required:
- desc
jobs.GetJobsResponse:
type: object
properties:
job_id:
$ref: '#/components/schemas/jobs.JobId'
name:
type: string
example: Bell State Sampling
description:
type: string
example: Bell State Sampling Example
device_id:
type: string
example: Kawasaki
shots:
type: integer
minimum: 1
maximum: 10000000
example: '1000'
job_info:
$ref: '#/components/schemas/jobs.JobInfo'
transpiler_info:
type: string
example: |-
{
"qubit_allocation": {
"0"": 12,
"1": 16
},
"skip_transpilation": false,
"seed_transpilation": 873
}
simulator_info:
type: string
example: |-
{
"n_qubits": 5,
"n_nodes": 12,
"n_per_node": 2,
"seed_simulation": 39058567,
"simulation_opt": {
"optimization_method": "light",
"optimization_block_size": 1,
"optimization_swap_level": 1
}
}
mitigation_info:
type: string
example: |
{ "ro_error_mitigation": "pseudo_inverse" }
status:
$ref: '#/components/schemas/jobs.JobStatus'
created_at:
type: string
format: date-time
example: '2022-10-19T11:45:34+09:00'
updated_at:
type: string
format: date-time
example: '2022-10-19T11:45:34'
orangekame3 marked this conversation as resolved.
Show resolved Hide resolved
required: []
example:
job_id: 7af020f6-2e38-4d70-8cf0-4349650ea08c
name: Bell State Sampling
description: Bell State Sampling Example
device_id: Kawasaki
job_info:
desc:
job_type: sampling
code: OPENQASM 3; qubit[2] q; bit[2] c; h q[0]; cnot q[0], q[1]; c = measure q;
transpiled_code: null
result: null
reason: null
transpiler_info: |-
{
"qubit_allocation": {
"0": 12,
"1": 16
},
"skip_transpilation": false,
"seed_transpilation": 873
}
simulator_info: |-
{
"n_qubits": 5,
"n_nodes": 12,
"n_per_node": 2,
"seed_simulation": 39058567,
"simulation_opt": {
"optimization_method": "light",
"optimization_block_size": 1,
"optimization_swap_level": 1
}
}
mitigation_info: |
{ "ro_error_mitigation": "pseudo_inverse" }
job_type: sampling
shots: 1000
status: submitted
created_at: '2022-10-19T11:45:34'
updated_at: '2022-10-19T11:45:34'
jobs.JobDef:
type: object
properties:
Expand Down
15 changes: 14 additions & 1 deletion backend/oas/provider/paths/jobs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,19 @@ jobs:
required: true
description: "Device identifier"
schema: { type: string, example: "Kawasaki" }
- in: query
name: fields
description: |-
Allows to specify an exact list of job properties to fetch for a single job. Each element of the list must be a valid name of job property.

If parameter is specified and requested job field is not defined for a job null is returned.

If parameter is omitted all available job properties are returned. Undefined job properties (null properties) are not included in the response.
required: false
schema:
type: string
maxLength: 1024
example: "job_id,status,name"
- in: query
name: status
description: "Additional search parameter:<br/> Search jobs with specified status only"
Expand All @@ -33,7 +46,7 @@ jobs:
schema:
type: array
items:
$ref: "../schemas/jobs.yaml#/jobs.JobDef"
$ref: "../schemas/jobs.yaml#/jobs.GetJobsResponse"
"400":
description: Bad Request
content:
Expand Down
108 changes: 108 additions & 0 deletions backend/oas/provider/schemas/jobs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,114 @@ jobs.JobDef:
created_at: 2022-10-19T11:45:34
updated_at: 2022-10-19T11:45:34

jobs.GetJobsResponse:
type: object
properties:
job_id:
$ref: "#/jobs.JobId"
name:
type: string
example: Bell State Sampling
description:
type: string
example: Bell State Sampling Example
device_id:
type: string
example: Kawasaki
shots:
type: integer
minimum: 1
maximum: 1e7
example: "1000"
job_info:
$ref: "#/jobs.JobInfo"
transpiler_info:
type: string
example: >-
{
"qubit_allocation": {
"0"": 12,
"1": 16
},
"skip_transpilation": false,
"seed_transpilation": 873
}
simulator_info:
type: string
example: >-
{
"n_qubits": 5,
"n_nodes": 12,
"n_per_node": 2,
"seed_simulation": 39058567,
"simulation_opt": {
"optimization_method": "light",
"optimization_block_size": 1,
"optimization_swap_level": 1
}
}
mitigation_info:
type: string
example: |
{ "ro_error_mitigation": "pseudo_inverse" }
status:
$ref: "#/jobs.JobStatus"
created_at:
type: string
format: date-time
example: 2022-10-19T11:45:34+09:00
updated_at:
type: string
format: date-time
example: 2022-10-19T11:45:34
required: []
example:
job_id: 7af020f6-2e38-4d70-8cf0-4349650ea08c
name: Bell State Sampling
description: Bell State Sampling Example
device_id: Kawasaki
job_info:
desc:
job_type: sampling
code: >-
OPENQASM 3;
qubit[2] q;
bit[2] c;
h q[0];
cnot q[0], q[1];
c = measure q;
transpiled_code: null
result: null
reason: null
transpiler_info: >-
{
"qubit_allocation": {
"0": 12,
"1": 16
},
"skip_transpilation": false,
"seed_transpilation": 873
}
simulator_info: >-
{
"n_qubits": 5,
"n_nodes": 12,
"n_per_node": 2,
"seed_simulation": 39058567,
"simulation_opt": {
"optimization_method": "light",
"optimization_block_size": 1,
"optimization_swap_level": 1
}
}
mitigation_info: |
{ "ro_error_mitigation": "pseudo_inverse" }
job_type: sampling
shots: 1000
status: submitted
created_at: 2022-10-19T11:45:34
updated_at: 2022-10-19T11:45:34

jobs.JobStatusUpdate:
type: object
properties:
Expand Down
Loading
Loading