Skip to content

Commit

Permalink
integration jobs.yaml and results.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
forest1040 committed Oct 10, 2024
1 parent 18180b0 commit cf7ed57
Show file tree
Hide file tree
Showing 19 changed files with 89 additions and 977 deletions.
342 changes: 6 additions & 336 deletions backend/oas/provider/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -305,94 +305,6 @@ paths:
$ref: '#/components/schemas/error.BadRequest'
example:
detail: Bad request malformed input data
/results:
post:
summary: Submit a quantum job result
tags:
- results
description: Submit a quantum job result
operationId: postResult
security: []
requestBody:
description: Result to be submitted
content:
application/json:
schema:
$ref: '#/components/schemas/results.ResultDef'
examples:
success sampling:
value:
jobId: 7af020f6-2e38-4d70-8cf0-4349650ea08c
status: SUCCESS
result:
'11': 4980
'00': 5020
reason: null
transpiledCode: OPENQASM 3;include "stdgates.inc";qubit[2] _all_qubits;let q = _all_qubits[0:1];h q[0];cx q[0], q[1];
success estimation:
value:
jobId: 7af020f6-2e38-4d70-8cf0-4349650ea08c
status: SUCCESS
result:
- 1.5
- 2.8
reason: null
transpiledCode: OPENQASM 3;include "stdgates.inc";qubit[2] _all_qubits;let q = _all_qubits[0:1];h q[0];cx q[0], q[1];
failure:
value:
jobId: 7af020f6-2e38-4d70-8cf0-4349650ea08c
status: FAILURE
result: null
reason: Invalid device parameter in request
transpiledCode: null
cancel:
value:
jobId: 7af020f6-2e38-4d70-8cf0-4349650ea08c
status: CANCELLED
result: null
reason: User cancelled
transpiledCode: null
responses:
'200':
description: Results submitted
content:
application/json:
schema:
$ref: '#/components/schemas/results.CreateResultResponse'
example:
message: Results submitted
'400':
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/error.BadRequest'
example:
detail: Bad request malformed input data
'404':
description: Not Found
content:
application/json:
schema:
$ref: '#/components/schemas/error.NotFoundError'
example:
detail: JobID not found
'409':
description: Result for jobId already exists
content:
application/json:
schema:
$ref: '#/components/schemas/error.ConflictError'
example:
detail: Result for jobId already exists
'500':
description: Internal Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/error.InternalServerError'
example:
detail: Internal server error
components:
schemas:
devices.DeviceStatusUpdate:
Expand Down Expand Up @@ -565,179 +477,9 @@ components:
- failed
- cancelled
example: submitted
jobs.JobId:
type: string
format: uuid
example: 7af020f6-2e38-4d70-8cf0-4349650ea08c
jobs.SamplingAction:
type: object
properties:
name:
type: string
pattern: sampling
example: sampling
nShots:
type: integer
minimum: 1
maximum: 10000000
example: '1000'
required:
- name
- nShots
jobs.SingleOperator:
type: array
items:
anyOf:
- type: string
description: Pauli string
example: X 0 Y 1 Z 5 I 2
- type: array
description: Real and imaginary components of complex coef value
items:
type: number
minItems: 2
maxItems: 2
example:
- 1.5
- 2.8
minItems: 2
maxItems: 2
jobs.Operator:
type: array
items:
$ref: '#/components/schemas/jobs.SingleOperator'
example:
- - X 0 X 1
- - 1.5
- 2.8
- - Y 0 Z 1
- - 1.2
- -2.e-8
jobs.EstimationAction:
type: object
properties:
name:
type: string
pattern: estimation
example: estimation
method:
type: string
enum:
- state_vector
- sampling
example: sampling
description: state_vector method valid only for 'simulator' devices
nShots:
type: integer
minimum: 1
maximum: 10000000
example: '1000'
description: Parameter valid only for sampling method
operator:
$ref: '#/components/schemas/jobs.Operator'
required:
- name
- method
- operator
jobs.Action:
type: object
oneOf:
- $ref: '#/components/schemas/jobs.SamplingAction'
- $ref: '#/components/schemas/jobs.EstimationAction'
jobs.JobInfo:
type: object
properties:
jobId:
$ref: '#/components/schemas/jobs.JobId'
code:
type: string
example: OPENQASM 3; qubit[2] q; bit[2] c; h q[0]; cnot q[0], q[1]; c = measure q;
device:
type: string
example: Kawasaki
nQubits:
type: integer
example: null
nNodes:
description: Parameter valid only for 'simulator' devices
type: integer
example: 12
action:
$ref: '#/components/schemas/jobs.Action'
qubitAllocation:
description: Parameter valid only for QPU devices
type: object
additionalProperties:
type: integer
example:
'0': 12
'1': 16
skipTranspilation:
type: boolean
example: false
seedTranspilation:
description: Parameter valid only if skipTranspilation is false
type: integer
example: 873
seedSimulation:
description: Parameter valid only for 'simulator' devices
type: integer
example: 39058567
roErrorMitigation:
description: Parameter valid only for QPU devices
type: string
enum:
- none
- pseudo_inverse
- least_square
example: pseudo_inverse
nPerNode:
description: Parameter valid only for simulator devices
type: integer
minimum: 1
example: 5
simulationOpt:
description: Parameter valid only for simulator devices
type: object
example:
optimizationMethod: light
optimizationBlockSize: 1
optimizationSwapLevel: 1
status:
$ref: '#/components/schemas/jobs.InternalJobStatus'
createdAt:
type: string
format: date-time
example: '2022-10-19T11:45:34+09:00'
required:
- jobId
- code
- device
- action
- skipTranspilation
- status
- createdAt
example:
jobId: 7af020f6-2e38-4d70-8cf0-4349650ea08c
code: OPENQASM 3; qubit[2] q; bit[2] c; h q[0]; cnot q[0], q[1]; c = measure q;
device: Kawasaki
nQubits: null
nNodes: 12
action:
name: sampling
nShots: 1000
qubitAllocation: null
skipTranspilation: false
seedTranspilation: 873
seedSimulation: 39058567
roErrorMitigation: null
nPerNode: 2
simulationOpt:
optimizationMethod: light
optimizationBlockSize: 1
optimizationSwapLevel: 1
status: QUEUED_FETCHED
createdAt: '2022-10-19T11:45:34+09:00'
type: string
example: '{''code'': ''{type: string, example: "OPENQASM 3; qubit[2] q; bit[2] c; h q[0]; cnot q[0], q[1]; c = measure q;"}'', ''Operator'': ''X 0 Y 1 Z 5 I 2'', ''result'': {''00'': 5020, ''11'': 4980}, ''transpiledCode'': '''', ''reason'': ''''}'
jobs.JobStatusUpdate:
type: object
properties:
Expand All @@ -761,85 +503,13 @@ components:
- QUEUED
- CANCELLING
example: QUEUED
jobs.JobId:
type: string
format: uuid
example: 7af020f6-2e38-4d70-8cf0-4349650ea08c
jobs.UnfetchedJobsResponse:
type: array
items:
oneOf:
- $ref: '#/components/schemas/jobs.JobInfo'
- $ref: '#/components/schemas/jobs.JobId'
results.ResultStatus:
type: string
enum:
- SUCCESS
- FAILURE
- CANCELLED
default: SUCCESS
example: SUCCESS
results.SamplingResult:
type: object
additionalProperties:
type: integer
minProperties: 2
example:
'11': 4980
'00': 5020
results.EstimationResult:
type: array
items:
type: number
minItems: 2
maxItems: 2
example:
- 1.5
- 2.8
results.Result:
oneOf:
- type: 'null'
- $ref: '#/components/schemas/results.SamplingResult'
- $ref: '#/components/schemas/results.EstimationResult'
results.ResultDef:
type: object
properties:
jobId:
$ref: '#/components/schemas/jobs.JobId'
status:
$ref: '#/components/schemas/results.ResultStatus'
result:
$ref: '#/components/schemas/results.Result'
reason:
type: string
nullable: true
transpiledCode:
type: string
nullable: true
qubitAllocation:
description: Parameter valid only for QPU devices
type: object
additionalProperties:
type: integer
nullable: true
example:
'0': 0
'1': 4
required:
- jobId
- status
- result
- reason
- transpiledCode
results.CreateResultResponse:
type: object
properties:
message:
type: string
required:
- message
example:
message: Results submitted
error.ConflictError:
type: object
properties:
detail:
type: string
required:
- detail
Loading

0 comments on commit cf7ed57

Please sign in to comment.