JobV1 module
- class JobV1
Implements the Job class. The user is not expected to create the Job object by themselves. The Job object is returned to the user, when the quantum circuit is submitted to the backend for execution using the “run” method in the backend class.
- See also:
BackendV1.run()
:- Attributes:
- version:
Current version of the Job class.
- _async:
Indicates that the jobs are executed asynchronously or synchronously. Async tasks can be monitored using job_montor or using the member function wait_for_final_state.
- See also:
- JobV1(job_id)
This is the constructor for the Job class. The user is not expected to create the Job object by themselves. The Job object is returned to the user, when the quantum circuit is submitted to the backend for execution using the “run” method in the backend class.
- Args:
- job_id (str):
The ID of the job that is to be created.
- Returns:
JobV1
- Raises:
- RunTimeError:
If there was an error creating the job.
- JobV1.version = 1
- JobV1._async = True
- job_id(self)
Returns the ID of the job object
- Args:
None.
- Returns:
str
- Raises:
- RunTimeError:
If there was an error creating the string object.
- done(self)
Returns whether the job has completed execution and reached status JobStatus.DONE
- Args:
None.
- Returns:
- True:
If the job status is JobStatus.DONE.
- False:
If the job status is other than JobStatus.DONE.
- Raises:
None.
- running(self)
Returns whether the job’s status is JobStatus.RUNNING
- Args:
None.
- Returns:
- True:
If the job status is JobStatus.RUNNING.
- False:
If the job status is not JobStatus.RUNNING.
- Raises:
None.
- cancelled(self)
Returns whether the job’s status is JobStatus.CANCELLED
- Args:
None.
- Returns:
- True:
If the job status is JobStatus.CANCELLED.
- False:
If the job status is not JobStatus.CANCELLED.
- Raises:
None.
- in_final_state(self)
Returns whether the job’s status is JobStatus.RUNNING or JobStatus.CANCELLED
- Args:
None.
- Returns:
- True:
If the job status is JobStatus.RUNNING or JobStatus.CANCELLED.
- False:
If the job status is not JobStatus.RUNNING or JobStatus.CANCELLED.
- Raises:
None.
- wait_for_final_state(self, timeout=0.0, wait=5.0, callback=None)
Waits until the job status turns into JobStatus.DONE, JobStatus.CANCELLED, or JobStatus.ERROR
- Args:
- timeout (double):
The maximum time in seconds, this method needs to wait for the status to change to one of JobStatus.DONE, JobStatus.CANCELLED, or JobStatus.ERROR.
- wait (double):
The time in seconds, the method waits before checking the status again.
- callback (method):
The method to call back and notify the user thread about the status of the job, each time it is checked, until the status changes to one of JobStatus.DONE, JobStatus.CANCELLED, or JobStatus.ERROR.
- Parameters for the callback method:
callback(job_id, JobStatus, JobObject)
If no callback is provided, no action is taken by the method.
- Returns:
None.
- Raises:
None.
- submit(self)
Submits the job to the backend’s queue for execution.
- Args:
None
- Returns:
None.
- Raises:
- NotImplemented:
This method is currently not supported. User should submit the quantum circuit through the backend’s run method.
- result(self)
Fetches the result object.
- Args:
None
- Returns:
- Result.
- See also:
Result class for more information.
- Raises:
None.
- cancel(self)
Cancels the job, if it is still in the queue. No action is taken, if the job completed execution or if it is currently running.
- Args:
None.
- Returns:
None.
- Raises:
None.
- status(self)
Returns the status of the job.
- Args:
None.
- Returns:
One of the following statuses is returned:
- “JobStatus.INITIALIZING”,
“JobStatus.QUEUED”, “JobStatus.VALIDATING”, “JobStatus.RUNNING”, “JobStatus.CANCELLED”, “JobStatus.DONE”, “JobStatus.ERROR”
- Raises:
None.
- backend(self)
Returns the backend the job is attached to
- Args:
None.
- Returns:
- BackendV1
- See Also:
BackendV1
- Raises:
None.