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

Issue #657 - Refactor Jobs interface #686

Merged
merged 26 commits into from
Aug 14, 2018
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
209cfd4
Issue 657 - Refactor Jobs interface
atilag Jul 25, 2018
1ad63ea
Restoring status() property from ibmqbackend.
atilag Jul 25, 2018
85e3cd4
* Better exception handling when there's an error in the thread
atilag Jul 27, 2018
f8fecb4
Addressing review comments
atilag Jul 28, 2018
cd14cec
Let's be friends linter...
atilag Jul 30, 2018
be58872
Fixed a bug where status() were called before self._future_exception
atilag Jul 30, 2018
a72ae09
* Fixed issue in LocalJob where calling some methods before .submit()
atilag Jul 30, 2018
5aa59c4
Linter hungry is infinite
atilag Jul 31, 2018
cd1bd24
* Updating in code documentation
atilag Jul 31, 2018
abf750f
Merge branch 'master' into jobs_simplification
atilag Jul 31, 2018
daa9616
Merge branch 'master' into jobs_simplification
atilag Aug 3, 2018
0b08f38
Added CHANGELOG entry for Jobs refactoring
atilag Aug 3, 2018
7620fa5
Linter gods are happy now
atilag Aug 3, 2018
f9db8b5
Adressing review comments:
atilag Aug 7, 2018
f4b1f10
Adressing some of the comments from the reviewers:
atilag Aug 7, 2018
c9c58ae
Adressing review commments:
atilag Aug 8, 2018
30cbfcf
* Removed all properties and some of them turned into methods.
atilag Aug 9, 2018
bb67805
* Fixed issues with error_msg not being properly managed
atilag Aug 9, 2018
4f0721e
* Refactoring for improving readability
atilag Aug 13, 2018
4851ae2
Merge branch 'master' into jobs_simplification
atilag Aug 13, 2018
8469e77
* Fixing tests
atilag Aug 13, 2018
ad5a0d8
* Fixed some bugs caught by the linter
atilag Aug 13, 2018
3fcf30a
* Lintering
atilag Aug 13, 2018
8b0ab1d
Merge branch 'master' into jobs_simplification
delapuente Aug 13, 2018
d47b20d
Fixing test workflows
delapuente Aug 14, 2018
622cd59
Fixing strings and comments.
delapuente Aug 14, 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
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Changed
- update the ``Qobj`` JSON schema. (#668, #677, #703, #709)
- update the local simulators for accepting ``Qobj`` as input. (#667)
- Use ``get_status_job()`` for checking IBMQJob status. (#641)
- ``Jobs API`` refactoring for simplifying its usage and some minor bug fixes. (#686)

Removed
-------
Expand Down
2 changes: 2 additions & 0 deletions qiskit/backends/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@
from .baseprovider import BaseProvider
from .basejob import BaseJob
from .jobstatus import JobStatus
from .joberror import JobError
from .jobtimeouterror import JobTimeoutError
20 changes: 0 additions & 20 deletions qiskit/backends/basejob.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,28 +32,8 @@ def cancel(self):
"""Attempt to cancel job."""
pass

# Property attributes
#####################
@property
@abstractmethod
def status(self):
"""Get backend status dictionary"""
pass

@property
@abstractmethod
def running(self):
"""True if job is currently running."""
pass

@property
@abstractmethod
def done(self):
"""True if call was successfully finished."""
pass

@property
@abstractmethod
def cancelled(self):
"""True if call was successfully cancelled"""
pass
14 changes: 11 additions & 3 deletions qiskit/backends/ibmq/ibmqbackend.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ def run(self, qobj):
Returns:
IBMQJob: an instance derived from BaseJob
"""
return IBMQJob(qobj, self._api, not self.configuration['simulator'])
job = IBMQJob(self._api, not self.configuration['simulator'], qobj=qobj)
job.submit()
return job

@property
def calibration(self):
Expand Down Expand Up @@ -216,7 +218,10 @@ def jobs(self, limit=50, skip=0, status=None, db_filter=None):
job_list = []
for job_info in job_info_list:
is_device = not bool(self._configuration.get('simulator'))
job = IBMQJob.from_api(job_info, self._api, is_device)
job = IBMQJob(self._api, is_device,
job_id=job_info.get('id'),
backend_name=job_info.get('backend').get('name'),
creation_date=job_info.get('creationDate'))
job_list.append(job)
return job_list

Expand All @@ -236,7 +241,10 @@ def retrieve_job(self, job_id):
if 'error' in job_info:
raise IBMQBackendError('failed to get job id "{}"'.format(job_id))
is_device = not bool(self._configuration.get('simulator'))
job = IBMQJob.from_api(job_info, self._api, is_device)
job = IBMQJob(self._api, is_device,
job_id=job_info.get('id'),
backend_name=job_info.get('backend').get('name'),
creation_date=job_info.get('creationDate'))
return job


Expand Down
Loading