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

get jobs from IBM Q backend #501

Merged
merged 32 commits into from
Jun 20, 2018
Merged
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
bcac889
job cancellation improvements for hubs
ewinston May 18, 2018
cd825f4
add alternate ibmqjob init method; from_api()
ewinston May 9, 2018
93aa378
add retrieve_job for ibmq backends
ewinston May 21, 2018
3df6680
add name to pre-qobj job submission
ewinston May 29, 2018
e00a1b5
fix bug in ibmq job submission
ewinston May 30, 2018
a49ea94
add circuit names to non-qobj ibmq job submission
ewinston May 30, 2018
5909a0d
remove qobj from result
ewinston May 31, 2018
f4e9898
add temporary hack for bit reordering
ewinston Jun 1, 2018
5a77bd9
remove qobj keyword from ibmqjob.result()
ewinston Jun 5, 2018
641becc
changed job timer.
ewinston Jun 6, 2018
8284926
linting
ewinston Jun 6, 2018
a72d9ec
simplify import of JobStatus
ewinston Jun 7, 2018
f437e0a
dissallow += results from different backends
ewinston Jun 11, 2018
3d5904e
moved JobStatus to it's own file.
ewinston Jun 11, 2018
c9fb95f
bug fix
ewinston Jun 11, 2018
97abf82
linting
ewinston Jun 11, 2018
0afb90d
fix bug in backend.jobs
ewinston Jun 13, 2018
7516e7a
allow retrieving old jobs without metadata
ewinston Jun 13, 2018
674af67
minor improvement to backend.jobs
ewinston Jun 13, 2018
2b79d6b
linting
ewinston Jun 13, 2018
0cfd4cb
speed up backend.jobs(). job_id->id
ewinston Jun 14, 2018
00cd596
linting
ewinston Jun 14, 2018
d7d1a4f
incorporating some suggestions from @atilag
ewinston Jun 15, 2018
10d0bc2
improvements to ibmqjob.status
ewinston Jun 15, 2018
2e72457
linting
ewinston Jun 15, 2018
49edb41
linting
ewinston Jun 15, 2018
8581dcb
linting
ewinston Jun 15, 2018
11d859b
update job status_msg
ewinston Jun 15, 2018
a426d1b
fix hanging job.status on server error
ewinston Jun 16, 2018
c2d1033
remove job status filtering
ewinston Jun 18, 2018
cee799c
linting
ewinston Jun 18, 2018
13274e6
Merge branch 'master' into backend_jobs
atilag Jun 19, 2018
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
Prev Previous commit
Next Next commit
fix bug in ibmq job submission
ewinston committed Jun 15, 2018

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit e00a1b54f4888c8d3ecea9226378d55391077910
9 changes: 8 additions & 1 deletion qiskit/backends/ibmq/ibmqjob.py
Original file line number Diff line number Diff line change
@@ -249,6 +249,9 @@ def job_id(self):
"""
Return backend determined job_id (also available in status method).
"""
while not self._job_id:
# job is initializing and hasn't gotten a job_id yet.
time.sleep(0.1)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_wait_for_submitting() :)

return self._job_id

@property
@@ -305,7 +308,11 @@ def _submit(self):
self._backend_name))
submit_info = {}
try:
submit_info = self._api.run_job(api_jobs, backend=backend_name)
submit_info = self._api.run_job(api_jobs, backend=backend_name,
shots=qobj['config']['shots'],
max_credits=qobj['config']['max_credits'],
seed=seed0,
hpc=hpc)
except ApiError as err:
self._status = JobStatus.ERROR
self._exception = err
1 change: 1 addition & 0 deletions test/python/test_backends.py
Original file line number Diff line number Diff line change
@@ -111,6 +111,7 @@ def test_remote_backend_status(self, QE_TOKEN, QE_URL,
remotes = ibmq_provider.available_backends({'local': False})
remotes = remove_backends_from_list(remotes)
for backend in remotes:
self.log.info(backend.status)
status = backend.status
schema_path = self._get_resource_path(
'deprecated/backends/backend_status_schema_py.json', path=Path.SCHEMAS)
14 changes: 6 additions & 8 deletions test/python/test_ibmqjob.py
Original file line number Diff line number Diff line change
@@ -238,8 +238,6 @@ def test_job_id(self):
qobj = qiskit._compiler.compile(self._qc, backend)
quantum_job = QuantumJob(qobj, backend, preformatted=True)
job = backend.run(quantum_job)
while job.status['status'] == JobStatus.INITIALIZING:
time.sleep(0.1)
self.log.info('job_id: %s', job.job_id)
self.assertTrue(job.job_id is not None)

@@ -261,12 +259,12 @@ def test_get_jobs_from_backend(self):
self.assertTrue(job_list)

def test_retrieve_job(self):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would make a test for a Job with multiple circuits.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test_run_simulator does this

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok!

backends = self._provider.available_backends({'simulator': False})
backend = lowest_pending_jobs(backends)
job_list = backend.jobs(limit=1, skip=0)
job_id = job_list[0].job_id
job = backend.retrieve_job(job_id)
self.assertTrue(job_id == job.job_id)
backend = self._provider.get_backend('ibmq_qasm_simulator')
qobj = qiskit._compiler.compile(self._qc, backend)
quantum_job = QuantumJob(qobj, backend, preformatted=True)
job = backend.run(quantum_job)
rjob = backend.retrieve_job(job.job_id)
self.assertTrue(job.job_id == rjob.job_id)

def test_retrieve_job_error(self):
backends = self._provider.available_backends({'simulator': False})