Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
qiskit-juqcs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
JUNIQ
qiskit-juqcs
Merge requests
!17
Support the combination of allocation, run and deallocation together.
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Support the combination of allocation, run and deallocation together.
cl-simplify-job-submission
into
master
Overview
0
Commits
3
Pipelines
0
Changes
2
Merged
c.luo
requested to merge
cl-simplify-job-submission
into
master
6 months ago
Overview
0
Commits
3
Pipelines
0
Changes
2
Expand
0
0
Merge request reports
Compare
master
version 2
8d6b13f9
6 months ago
version 1
d6672ec6
6 months ago
master (base)
and
latest version
latest version
f1ce54f6
3 commits,
6 months ago
version 2
8d6b13f9
2 commits,
6 months ago
version 1
d6672ec6
1 commit,
6 months ago
2 files
+
23
−
2
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
juqcs/backend.py
+
20
−
2
Options
@@ -87,7 +87,7 @@ class JuqcsBackend(Backend):
'''
Check if there is a running allocation attached to this backend instance.
'''
# never allocated or expired
if
(
self
.
_expiration_time
is
None
)
\
or
(
self
.
_expiration_time
<
datetime
.
datetime
.
now
()):
or
(
self
.
_expiration_time
<
datetime
.
datetime
.
now
()):
self
.
_expiration_time
=
None
self
.
_allocation_id
=
None
# delete expired ID
self
.
_alloc_qubits
=
None
# delete alloc qubits
@@ -228,12 +228,30 @@ class JuqcsBackend(Backend):
Run {run_input} (QuantumCircuit or list(QuantumCircuit)) on pre-existing allocation.
Returns:
JuqcsJob
'''
'''
# automatically allocate based on the max number of qubits in the input circuits
self_allocated
=
False
if
not
self
.
_allocation_is_valid
():
self_allocated
=
True
if
isinstance
(
run_input
,
list
):
required_qubits
=
max
(
circuit
.
num_qubits
for
circuit
in
run_input
)
else
:
required_qubits
=
run_input
.
num_qubits
print
(
"
Allocating nodes for 30 minutes.
"
)
self
.
allocate
(
max_qubits
=
required_qubits
,
minutes
=
30
)
job_id
=
str
(
uuid4
())
print
(
'
Submitting circuits for simulation, this may take a few minutes...
'
)
print
(
f
'
the job id is :
{
job_id
}
'
)
juqcs_job
=
JuqcsJob
(
self
,
job_id
)
\
.
submit
(
run_input
,
**
options
)
# automatically deallocate if the allocation is automatic
if
self_allocated
is
True
:
self
.
deallocate
()
self_allocated
=
False
return
juqcs_job
Loading