Skip to content

Commit add6250

Browse files
authored
Merge pull request #311 from oqtopus-team/develop
release: 2025-11-21 16:19
2 parents b677356 + 2c8110c commit add6250

File tree

33 files changed

+494
-431
lines changed

33 files changed

+494
-431
lines changed

backend/db/conf.d/my.cnf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
character-set-server=utf8mb4
33
collation-server=utf8mb4_unicode_ci
44
default_authentication_plugin= mysql_native_password
5-
5+
sql_mode=NO_ENGINE_SUBSTITUTION
66
[client]
77
default-character-set=utf8mb4

backend/db/init/01.schema.sql

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ CREATE TABLE IF NOT EXISTS main.devices (
1111
device_info TEXT,
1212
calibrated_at DATETIME,
1313
description VARCHAR(128) NOT NULL,
14-
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
15-
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
14+
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
15+
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
1616
);
1717

1818
drop table if exists main.jobs;
@@ -34,8 +34,8 @@ CREATE TABLE IF NOT EXISTS main.jobs (
3434
ready_at DATETIME,
3535
running_at DATETIME,
3636
ended_at DATETIME,
37-
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
38-
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
37+
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
38+
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
3939
);
4040

4141
drop table if exists main.users;

backend/oas/provider/openapi.yaml

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,19 @@ paths:
206206
description: Additional search parameter:<br/> Search jobs with specified status only
207207
schema:
208208
$ref: '#/components/schemas/jobs.JobStatus'
209+
- name: fields
210+
in: query
211+
description: |-
212+
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.
213+
214+
If parameter is specified and requested job field is not defined for a job null is returned.
215+
216+
If parameter is omitted all available job properties are returned.
217+
required: false
218+
schema:
219+
type: string
220+
maxLength: 1024
221+
example: job_id,status,name
209222
- in: query
210223
name: limit
211224
required: false
@@ -228,7 +241,7 @@ paths:
228241
schema:
229242
type: array
230243
items:
231-
$ref: '#/components/schemas/jobs.JobDef'
244+
$ref: '#/components/schemas/jobs.Job'
232245
'400':
233246
description: Bad Request
234247
content:
@@ -774,7 +787,7 @@ components:
774787
default: null
775788
required:
776789
- program
777-
jobs.JobDef:
790+
jobs.Job:
778791
type: object
779792
properties:
780793
job_id:
@@ -868,13 +881,7 @@ components:
868881
example: '2022-10-19T11:45:34+09:00'
869882
nullable: true
870883
default: null
871-
required:
872-
- job_id
873-
- device_id
874-
- job_type
875-
- job_info
876-
- shots
877-
- status
884+
required: []
878885
example:
879886
job_id: 7af020f6-2e38-4d70-8cf0-4349650ea08c
880887
name: Bell State Sampling
@@ -914,6 +921,18 @@ components:
914921
ready_at: '2022-10-19T11:45:34+09:00'
915922
running_at: '2022-10-19T11:45:34+09:00'
916923
ended_at: '2022-10-19T11:45:34+09:00'
924+
jobs.JobDef:
925+
allOf:
926+
- $ref: '#/components/schemas/jobs.Job'
927+
required:
928+
- job_id
929+
- name
930+
- job_type
931+
- status
932+
- device_id
933+
- shots
934+
- job_info
935+
- submitted_at
917936
jobs.JobStatusUpdate:
918937
type: object
919938
properties:

backend/oas/provider/paths/jobs.yaml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,19 @@ jobs:
2020
description: "Additional search parameter:<br/> Search jobs with specified status only"
2121
schema:
2222
$ref: "../schemas/jobs.yaml#/jobs.JobStatus"
23+
- name: fields
24+
in: query
25+
description: |-
26+
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.
27+
28+
If parameter is specified and requested job field is not defined for a job null is returned.
29+
30+
If parameter is omitted all available job properties are returned.
31+
required: false
32+
schema:
33+
type: string
34+
maxLength: 1024
35+
example: "job_id,status,name"
2336
- in: query
2437
name: limit
2538
required: false
@@ -40,7 +53,7 @@ jobs:
4053
schema:
4154
type: array
4255
items:
43-
$ref: "../schemas/jobs.yaml#/jobs.JobDef"
56+
$ref: "../schemas/jobs.yaml#/jobs.Job"
4457
"400":
4558
description: Bad Request
4659
content:

backend/oas/provider/schemas/jobs.yaml

Lines changed: 14 additions & 149 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ jobs.JobType:
194194
- multi_manual
195195
- sse
196196

197-
jobs.JobDef:
197+
jobs.Job:
198198
type: object
199199
properties:
200200
job_id:
@@ -294,12 +294,7 @@ jobs.JobDef:
294294
nullable: true
295295
default: null
296296
required:
297-
- job_id
298-
- device_id
299-
- job_type
300-
- job_info
301-
- shots
302-
- status
297+
[]
303298
example:
304299
job_id: 7af020f6-2e38-4d70-8cf0-4349650ea08c
305300
name: Bell State Sampling
@@ -348,148 +343,18 @@ jobs.JobDef:
348343
running_at: 2022-10-19T11:45:34+09:00
349344
ended_at: 2022-10-19T11:45:34+09:00
350345

351-
jobs.GetJobsResponse:
352-
type: object
353-
properties:
354-
job_id:
355-
$ref: "#/jobs.JobId"
356-
nullable: false
357-
name:
358-
type: string
359-
example: Bell State Sampling
360-
nullable: true
361-
default: null
362-
description:
363-
type: string
364-
example: Bell State Sampling Example
365-
nullable: false
366-
device_id:
367-
type: string
368-
example: Kawasaki
369-
nullable: false
370-
shots:
371-
type: integer
372-
minimum: 1
373-
maximum: 1e7
374-
nullable: false
375-
example: "1000"
376-
job_info:
377-
$ref: "#/jobs.JobInfo"
378-
nullable: false
379-
transpiler_info:
380-
type: string
381-
nullable: true
382-
example: >-
383-
{
384-
"qubit_allocation": {
385-
"0"": 12,
386-
"1": 16
387-
},
388-
"skip_transpilation": false,
389-
"seed_transpilation": 873
390-
}
391-
simulator_info:
392-
type: string
393-
nullable: true
394-
example: >-
395-
{
396-
"n_qubits": 5,
397-
"n_nodes": 12,
398-
"n_per_node": 2,
399-
"seed_simulation": 39058567,
400-
"simulation_opt": {
401-
"optimization_method": "light",
402-
"optimization_block_size": 1,
403-
"optimization_swap_level": 1
404-
}
405-
}
406-
mitigation_info:
407-
type: string
408-
nullable: true
409-
example: |
410-
{ "ro_error_mitigation": "pseudo_inverse" }
411-
status:
412-
$ref: "#/jobs.JobStatus"
413-
nullable: false
414-
execution_time:
415-
type: number
416-
nullable: true
417-
default: null
418-
example: "10.123"
419-
submitted_at:
420-
type: string
421-
format: date-time
422-
nullable: true
423-
default: null
424-
example: 2022-10-19T11:45:34+09:00
425-
ready_at:
426-
type: string
427-
format: date-time
428-
nullable: true
429-
default: null
430-
example: 2022-10-19T11:45:34+09:00
431-
running_at:
432-
type: string
433-
format: date-time
434-
nullable: true
435-
default: null
436-
example: 2022-10-19T11:45:34+09:00
437-
ended_at:
438-
type: string
439-
format: date-time
440-
nullable: true
441-
default: null
442-
example: 2022-10-19T11:45:34+09:00
443-
required: []
444-
example:
445-
job_id: 7af020f6-2e38-4d70-8cf0-4349650ea08c
446-
name: Bell State Sampling
447-
description: Bell State Sampling Example
448-
device_id: Kawasaki
449-
job_info:
450-
program:
451-
- >-
452-
OPENQASM 3;
453-
qubit[2] q;
454-
bit[2] c;
455-
h q[0];
456-
cnot q[0], q[1];
457-
c = measure q;
458-
combined_program: null
459-
transpiled_prgoram: null
460-
result: {}
461-
reason: null
462-
transpiler_info: >-
463-
{
464-
"qubit_allocation": {
465-
"0": 12,
466-
"1": 16
467-
},
468-
"skip_transpilation": false,
469-
"seed_transpilation": 873
470-
}
471-
simulator_info: >-
472-
{
473-
"n_qubits": 5,
474-
"n_nodes": 12,
475-
"n_per_node": 2,
476-
"seed_simulation": 39058567,
477-
"simulation_opt": {
478-
"optimization_method": "light",
479-
"optimization_block_size": 1,
480-
"optimization_swap_level": 1
481-
}
482-
}
483-
mitigation_info: |
484-
{ "ro_error_mitigation": "pseudo_inverse" }
485-
job_type: sampling
486-
shots: 1000
487-
status: submitted
488-
execution_time: 10.123
489-
submitted_at: 2022-10-19T11:45:34+09:00
490-
ready_at: 2022-10-19T11:45:34+09:00
491-
running_at: 2022-10-19T11:45:34+09:00
492-
ended_at: 2022-10-19T11:45:34+09:00
346+
jobs.JobDef:
347+
allOf:
348+
- $ref: '#/jobs.Job'
349+
required:
350+
- job_id
351+
- name
352+
- job_type
353+
- status
354+
- device_id
355+
- shots
356+
- job_info
357+
- submitted_at
493358

494359
jobs.JobStatusUpdate:
495360
type: object

backend/oqtopus_cloud/admin/routers/announcements.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,9 @@ def get_announcements_list(
7676
return GetAnnouncementsListResponse(announcements=announcements_list)
7777

7878
except Exception as e:
79-
logger.exception(f"error: {str(e)}")
80-
return InternalServerErrorResponse(message=str(e))
79+
tracer.put_annotation("error", str(e))
80+
logger.exception(f"Internal Server Error: {e}")
81+
return InternalServerErrorResponse(message="Internal Server Error")
8182

8283

8384
@router.get(
@@ -108,8 +109,9 @@ def get_announcement(
108109
return NotFoundErrorResponse(message=message)
109110

110111
except Exception as e:
111-
logger.exception(f"error: {str(e)}")
112-
return InternalServerErrorResponse(message=str(e))
112+
tracer.put_annotation("error", str(e))
113+
logger.exception(f"Internal Server Error: {e}")
114+
return InternalServerErrorResponse(message="Internal Server Error")
113115

114116

115117
@router.post(
@@ -142,8 +144,9 @@ def register_announcements(
142144
return BadRequestErrorResponse(message=str(e))
143145

144146
except Exception as e:
145-
logger.exception(f"error: {str(e)}")
146-
return InternalServerErrorResponse(message=str(e))
147+
tracer.put_annotation("error", str(e))
148+
logger.exception(f"Internal Server Error: {e}")
149+
return InternalServerErrorResponse(message="Internal Server Error")
147150

148151

149152
@router.patch(
@@ -185,7 +188,7 @@ def update_announcements_data(
185188
return BadRequestErrorResponse(message=str(e))
186189

187190
except Exception as e:
188-
tracer.put_annotation("db_error", str(e))
191+
tracer.put_annotation("error", str(e))
189192
logger.exception(f"Internal Server Error: {e}")
190193
return InternalServerErrorResponse(message="Internal Server Error")
191194

@@ -223,7 +226,7 @@ def delete_announcement(
223226
return SuccessResponse(message="Announcement deleted successfully")
224227

225228
except Exception as e:
226-
tracer.put_annotation("db_error", str(e))
229+
tracer.put_annotation("error", str(e))
227230
logger.exception(f"Internal Server Error: {e}")
228231
return InternalServerErrorResponse(message="Internal Server Error")
229232

0 commit comments

Comments
 (0)