Skip to content

Commit

Permalink
Merge pull request #46 from oqtopus-team/develop
Browse files Browse the repository at this point in the history
release: 2024-10-24 10:11
  • Loading branch information
orangekame3 authored Oct 24, 2024
2 parents b7f45c7 + 2e80678 commit 2b6b415
Show file tree
Hide file tree
Showing 73 changed files with 344 additions and 594 deletions.
2 changes: 1 addition & 1 deletion backend/db/init/01.schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ CREATE TABLE IF NOT EXISTS main.tasks (
simulation_opt text,
ro_error_mitigation enum('none', 'pseudo_inverse', 'least_square'),
note VARCHAR(1024),
status ENUM ('QUEUED', 'QUEUED_FETCHED', 'RUNNING', 'COMPLETED', 'FAILED', 'CANCELLING', 'CANCELLING_FETCHED', 'CANCELLED') NOT NULL DEFAULT 'QUEUED',
status ENUM ('QUEUED', 'RUNNING', 'COMPLETED', 'FAILED', 'CANCELLING', 'CANCELLED') NOT NULL DEFAULT 'QUEUED',
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (device) REFERENCES devices(id)
);
Expand Down
2 changes: 1 addition & 1 deletion backend/db/init/03.insert_task.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ SELECT UNHEX(REPLACE('7af020f6-2e38-4d70-8cf0-4349650ea08c', '-', '')), 'admin',
WHERE NOT EXISTS (SELECT * FROM main.tasks WHERE owner = 'admin' AND name = 'Test task 1');

INSERT INTO main.tasks (id, owner, name, device, n_qubits, n_nodes, code, action, method, shots, operator, qubit_allocation, skip_transpilation, seed_transpilation, seed_simulation, n_per_node, simulation_opt, ro_error_mitigation, note, status, created_at)
SELECT UNHEX(REPLACE('7af020f6-2e38-4d70-8cf0-4349650ea08d', '-', '')), 'admin', 'Test task 2', 'Kawasaki', 2, 12, 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg q[2];\nh q[0];\ncx q[0], q[1];\nmeasure q[0] -> c[0];\nmeasure q[1] -> c[1];', 'sampling', 'state_vector', 1024, 'Z0*Z1', NULL, false, NULL, NULL, 1, NULL, 'none', NULL, 'QUEUED_FETCHED', CURRENT_TIMESTAMP
SELECT UNHEX(REPLACE('7af020f6-2e38-4d70-8cf0-4349650ea08d', '-', '')), 'admin', 'Test task 2', 'Kawasaki', 2, 12, 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg q[2];\nh q[0];\ncx q[0], q[1];\nmeasure q[0] -> c[0];\nmeasure q[1] -> c[1];', 'sampling', 'state_vector', 1024, 'Z0*Z1', NULL, false, NULL, NULL, 1, NULL, 'none', NULL, 'QUEUED', CURRENT_TIMESTAMP
WHERE NOT EXISTS (SELECT * FROM main.tasks WHERE owner = 'admin' AND name = 'Test task 2');
69 changes: 6 additions & 63 deletions backend/oas/provider/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ servers:
- url: http://localhost:8888
description: Local server url
paths:
/internal/devices/{deviceId}:
/devices/{deviceId}:
patch:
tags:
- devices
Expand Down Expand Up @@ -121,7 +121,7 @@ paths:
$ref: '#/components/schemas/error.InternalServerError'
example:
detail: Internal server error
/internal/tasks:
/tasks:
get:
tags:
- tasks
Expand Down Expand Up @@ -150,7 +150,7 @@ paths:
example: 1
- in: query
name: timestamp
description: Additional search parameter:<br/> Fetch tasks created after the specified timetsamp
description: Additional search parameter:<br/> Tasks created after the specified timetsamp
schema:
type: string
example: '2022-12-15 15:54:46'
Expand Down Expand Up @@ -179,7 +179,7 @@ paths:
$ref: '#/components/schemas/error.InternalServerError'
example:
detail: Internal server error
/internal/tasks/{taskId}:
/tasks/{taskId}:
get:
summary: Get a task by ID
description: Get a task by ID
Expand Down Expand Up @@ -262,50 +262,7 @@ paths:
$ref: '#/components/schemas/error.NotFoundError'
example:
detail: task not found
/internal/tasks/unfetched:
get:
summary: Fetch tasks for device
description: 'Fetches tasks for execution/cancel<br/><br/>Operation is valid only for task with status: QUEUED or CANCELLING. After the operation task status is changed to appropriate FETCHED state (QUEUED_FETCHED or CANCELLING_FETCHED)'
operationId: getUnfetchedTasks
security: []
tags:
- tasks
parameters:
- in: query
name: deviceId
required: true
description: Device identifier
schema:
type: string
example: Kawasaki
- in: query
name: status
required: true
description: Fetch tasks with specified status
schema:
$ref: '#/components/schemas/tasks.InternalFetchableTaskStatus'
- in: query
name: maxResults
description: Additional search parameter:<br/> Set max number of quantum tasks to return in single request
schema:
type: integer
example: 1
responses:
'200':
description: List of tasks for execution (all task data) / cancel (taskIds only)
content:
application/json:
schema:
$ref: '#/components/schemas/tasks.UnfetchedTasksResponse'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/error.BadRequest'
example:
detail: Bad request malformed input data
/internal/results:
/results:
post:
summary: Submit a quantum task result
tags:
Expand Down Expand Up @@ -559,12 +516,10 @@ components:
type: string
enum:
- QUEUED
- QUEUED_FETCHED
- RUNNING
- COMPLETED
- FAILED
- CANCELLING
- CANCELLING_FETCHED
- CANCELLED
example: QUEUED
tasks.TaskId:
Expand Down Expand Up @@ -738,7 +693,7 @@ components:
optimizationMethod: light
optimizationBlockSize: 1
optimizationSwapLevel: 1
status: QUEUED_FETCHED
status: QUEUED
createdAt: '2022-10-19T11:45:34+09:00'
tasks.TaskStatusUpdate:
type: object
Expand All @@ -757,18 +712,6 @@ components:
type: string
required:
- message
tasks.InternalFetchableTaskStatus:
type: string
enum:
- QUEUED
- CANCELLING
example: QUEUED
tasks.UnfetchedTasksResponse:
type: array
items:
oneOf:
- $ref: '#/components/schemas/tasks.TaskInfo'
- $ref: '#/components/schemas/tasks.TaskId'
results.ResultStatus:
type: string
enum:
Expand Down
43 changes: 1 addition & 42 deletions backend/oas/provider/paths/tasks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ tasks:
schema: {type: integer, example: 1}
- in: query
name: timestamp
description: "Additional search parameter:<br/> Fetch tasks created after the specified timetsamp"
description: "Additional search parameter:<br/> Tasks created after the specified timetsamp"
schema: {type: string, example: '2022-12-15 15:54:46'}
responses:
"200":
Expand Down Expand Up @@ -132,44 +132,3 @@ tasks.taskId:
$ref: '../schemas/error.yaml#/error.NotFoundError'
example:
detail: task not found

tasks.unfetched:
get:
summary: "Fetch tasks for device"
description: "Fetches tasks for execution/cancel<br/><br/>Operation is valid only for task with status: QUEUED or CANCELLING. After the operation task status is changed to appropriate FETCHED state (QUEUED_FETCHED or CANCELLING_FETCHED)"
operationId: getUnfetchedTasks
security: []
tags:
- tasks
parameters:
- in: query
name: deviceId
required: true
description: "Device identifier"
schema: {type: string, example: "Kawasaki"}
- in: query
name: status
required: true
description: "Fetch tasks with specified status"
schema:
$ref: "../schemas/tasks.yaml#/tasks.InternalFetchableTaskStatus"
- in: query
name: maxResults
description: "Additional search parameter:<br/> Set max number of quantum tasks to return in single request"
schema: {type: integer, example: 1}

responses:
"200":
description: "List of tasks for execution (all task data) / cancel (taskIds only)"
content:
application/json:
schema:
$ref: "../schemas/tasks.yaml#/tasks.UnfetchedTasksResponse"
"400":
description: Bad Request
content:
application/json:
schema:
$ref: '../schemas/error.yaml#/error.BadRequest'
example:
detail: Bad request malformed input data
10 changes: 4 additions & 6 deletions backend/oas/provider/root.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,11 @@ servers:
- url: http://localhost:8888
description: Local server url
paths:
/internal/devices/{deviceId}:
/devices/{deviceId}:
$ref: ./paths/devices.yaml#/devices.deviceId
/internal/tasks:
/tasks:
$ref: ./paths/tasks.yaml#/tasks
/internal/tasks/{taskId}:
/tasks/{taskId}:
$ref: ./paths/tasks.yaml#/tasks.taskId
/internal/tasks/unfetched:
$ref: ./paths/tasks.yaml#/tasks.unfetched
/internal/results:
/results:
$ref: ./paths/results.yaml#/results
16 changes: 2 additions & 14 deletions backend/oas/provider/schemas/tasks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ tasks.TaskId:

tasks.InternalTaskStatus:
type: string
enum: ["QUEUED", "QUEUED_FETCHED", "RUNNING", "COMPLETED", "FAILED", "CANCELLING", "CANCELLING_FETCHED", "CANCELLED"]
enum: ["QUEUED", "RUNNING", "COMPLETED", "FAILED", "CANCELLING", "CANCELLED"]
example: "QUEUED"

tasks.Action:
Expand Down Expand Up @@ -163,7 +163,7 @@ tasks.TaskInfo:
optimizationBlockSize: 1,
optimizationSwapLevel: 1
}
status: QUEUED_FETCHED
status: QUEUED
createdAt: "2022-10-19T11:45:34+09:00"

tasks.TaskStatusUpdate:
Expand All @@ -185,15 +185,3 @@ tasks.TaskStatusUpdateResponse:
required:
- message

tasks.UnfetchedTasksResponse:
type: array
items:
oneOf:
- $ref: '#/tasks.TaskInfo'
- $ref: '#/tasks.TaskId'

tasks.InternalFetchableTaskStatus:
type: string
enum: ["QUEUED", "CANCELLING"]
example: "QUEUED"

Loading

0 comments on commit 2b6b415

Please sign in to comment.