Shortcuts

qiskit.providers.ibmq.IBMQBackend

class IBMQBackend(configuration, provider, credentials, api_client)[소스]

Backend class interfacing with an IBM Quantum Experience device.

You can run experiments on a backend using the run() method after assembling them into the Qobj format. The run() method returns an IBMQJob instance that represents the submitted job. Each job has a unique job ID, which can later be used to retrieve the job. An example of this flow:

from qiskit import IBMQ, assemble, transpile
from qiskit.circuit.random import random_circuit

provider = IBMQ.load_account()
backend = provider.backends.ibmq_vigo
qx = random_circuit(n_qubits=5, depth=4)
qobj = assemble(transpile(qx, backend=backend), backend=backend)
job = backend.run(qobj)
retrieved_job = backend.retrieve_job(job.job_id())

참고

You should not instantiate the IBMQBackend class directly. Instead, use the methods provided by an AccountProvider instance to retrieve and handle backends.

Other methods return information about the backend. For example, the status() method returns a BackendStatus instance. The instance contains the operational and pending_jobs attributes, which state whether the backend is operational and also the number of jobs in the server queue for the backend, respectively:

status = backend.status()
is_operational = status.operational
jobs_in_queue = status.pending_jobs

It is also possible to see the number of remaining jobs you are able to submit to the backend with the job_limit() method, which returns a BackendJobLimit instance:

job_limit = backend.job_limit()

IBMQBackend constructor.

매개변수
  • configuration (Union[QasmBackendConfiguration, PulseBackendConfiguration]) – Backend configuration.

  • provider (AccountProvider) – IBM Quantum Experience account provider

  • credentials (Credentials) – IBM Quantum Experience credentials.

  • api_client (AccountClient) – IBM Quantum Experience client used to communicate with the server.

__init__(configuration, provider, credentials, api_client)[소스]

IBMQBackend constructor.

매개변수
  • configuration (Union[QasmBackendConfiguration, PulseBackendConfiguration]) – Backend configuration.

  • provider (AccountProvider) – IBM Quantum Experience account provider

  • credentials (Credentials) – IBM Quantum Experience credentials.

  • api_client (AccountClient) – IBM Quantum Experience client used to communicate with the server.

Methods

__init__(configuration, provider, …)

IBMQBackend constructor.

active_jobs([limit])

Return the unfinished jobs submitted to this backend.

configuration()

Return the backend configuration.

defaults([refresh])

Return the pulse defaults for the backend.

job_limit()

Return the job limit for the backend.

jobs([limit, skip, status, job_name, …])

Return the jobs submitted to this backend, subject to optional filtering.

name()

Return the backend name.

properties([refresh, datetime])

Return the backend properties, subject to optional filtering.

provider()

Return the backend Provider.

remaining_jobs_count()

Return the number of remaining jobs that could be submitted to the backend.

reservations([start_datetime, end_datetime])

Return backend reservations.

retrieve_job(job_id)

Return a single job submitted to this backend.

run(qobj[, job_name, job_share_level, …])

Run a Qobj asynchronously.

status()

Return the backend status.

version()

Return the backend version.

active_jobs(limit=10)[소스]

Return the unfinished jobs submitted to this backend.

Return the jobs submitted to this backend, with this provider, that are currently in an unfinished job status state. The unfinished JobStatus states include: INITIALIZING, VALIDATING, QUEUED, and RUNNING.

매개변수

limit (int) – Number of jobs to retrieve.

반환 형식

List[IBMQJob]

반환값

A list of the unfinished jobs for this backend on this provider.

configuration()

Return the backend configuration.

반환값

the configuration for the backend.

반환 형식

BackendConfiguration

defaults(refresh=False)[소스]

Return the pulse defaults for the backend.

매개변수

refresh (bool) – If True, re-query the server for the backend pulse defaults. Otherwise, return a cached version.

반환 형식

Optional[PulseDefaults]

반환값

The backend pulse defaults or None if the backend does not support pulse.

job_limit()[소스]

Return the job limit for the backend.

The job limit information includes the current number of active jobs you have on the backend and the maximum number of active jobs you can have on it.

참고

Job limit information for a backend is provider specific. For example, if you have access to the same backend via different providers, the job limit information might be different for each provider.

If the method call was successful, you can inspect the job limit for the backend by accessing the maximum_jobs and active_jobs attributes of the BackendJobLimit instance returned. For example:

backend_job_limit = backend.job_limit()
maximum_jobs = backend_job_limit.maximum_jobs
active_jobs = backend_job_limit.active_jobs

If maximum_jobs is equal to None, then there is no limit to the maximum number of active jobs you could have on the backend.

반환 형식

BackendJobLimit

반환값

The job limit for the backend, with this provider.

예외

IBMQBackendApiProtocolError – If an unexpected value is received from the server.

jobs(limit=10, skip=0, status=None, job_name=None, start_datetime=None, end_datetime=None, job_tags=None, job_tags_operator='OR', descending=True, db_filter=None)[소스]

Return the jobs submitted to this backend, subject to optional filtering.

Retrieve jobs submitted to this backend that match the given filters and paginate the results if desired. Note that the server has a limit for the number of jobs returned in a single call. As a result, this function might involve making several calls to the server. See also the skip parameter for more control over pagination.

매개변수
  • limit (int) – Number of jobs to retrieve.

  • skip (int) – Starting index for the job retrieval.

  • status (Union[JobStatus, str, List[Union[JobStatus, str]], None]) – Only get jobs with this status or one of the statuses. For example, you can specify status=JobStatus.RUNNING or status=》RUNNING》 or status=[《RUNNING》, 《ERROR》]

  • job_name (Optional[str]) – Filter by job name. The job_name is matched partially and regular expressions can be used.

  • start_datetime (Optional[datetime]) – Filter by the given start date, in local time. This is used to find jobs whose creation dates are after (greater than or equal to) this local date/time.

  • end_datetime (Optional[datetime]) – Filter by the given end date, in local time. This is used to find jobs whose creation dates are before (less than or equal to) this local date/time.

  • job_tags (Optional[List[str]]) – Filter by tags assigned to jobs.

  • job_tags_operator (Optional[str]) –

    Logical operator to use when filtering by job tags. Valid values are 《AND》 and 《OR》:

    • If 《AND》 is specified, then a job must have all of the tags specified in job_tags to be included.

    • If 《OR》 is specified, then a job only needs to have any of the tags specified in job_tags to be included.

  • descending (bool) – If True, return the jobs in descending order of the job creation date (newest first). If False, return in ascending order.

  • db_filter (Optional[Dict[str, Any]]) –

    A loopback-based filter. This is an interface to a database where filter. Some examples of its usage are:

    Filter last five jobs with errors:

    job_list = backend.jobs(limit=5, status=JobStatus.ERROR)
    

    Filter last five jobs with hub name ibm-q:

    filter = {'hubInfo.hub.name': 'ibm-q'}
    job_list = backend.jobs(limit=5, db_filter=filter)
    

반환 형식

List[IBMQJob]

반환값

A list of jobs that match the criteria.

예외

IBMQBackendValueError – If a keyword value is not recognized.

name()

Return the backend name.

반환값

the name of the backend.

반환 형식

str

properties(refresh=False, datetime=None)[소스]

Return the backend properties, subject to optional filtering.

매개변수
  • refresh (bool) – If True, re-query the server for the backend properties. Otherwise, return a cached version.

  • datetime (Optional[datetime]) – By specifying datetime, this function returns an instance of the BackendProperties whose timestamp is closest to, but older than, the specified datetime.

반환 형식

Optional[BackendProperties]

반환값

The backend properties or None if the backend properties are not currently available.

예외

TypeError – If an input argument is not of the correct type.

provider()

Return the backend Provider.

반환값

the Provider responsible for the backend.

반환 형식

BaseProvider

remaining_jobs_count()[소스]

Return the number of remaining jobs that could be submitted to the backend.

참고

The number of remaining jobs for a backend is provider specific. For example, if you have access to the same backend via different providers, the number of remaining jobs might be different for each. See BackendJobLimit for the job limit information of a backend.

If None is returned, there are no limits to the maximum number of active jobs you could have on the backend.

반환 형식

Optional[int]

반환값

The remaining number of jobs a user could submit to the backend, with this provider, before the maximum limit on active jobs is reached.

예외

IBMQBackendApiProtocolError – If an unexpected value is received from the server.

reservations(start_datetime=None, end_datetime=None)[소스]

Return backend reservations.

If start_datetime and/or end_datetime is specified, reservations with time slots that overlap with the specified time window will be returned.

Some of the reservation information, such as scheduling mode, is only available if you are the owner of the reservation.

매개변수
  • start_datetime (Optional[datetime]) – Filter by the given start date/time, in local timezone.

  • end_datetime (Optional[datetime]) – Filter by the given end date/time, in local timezone.

반환 형식

List[BackendReservation]

반환값

A list of reservations that match the criteria.

retrieve_job(job_id)[소스]

Return a single job submitted to this backend.

매개변수

job_id (str) – The ID of the job to retrieve.

반환 형식

IBMQJob

반환값

The job with the given ID.

예외

IBMQBackendError – If job retrieval failed.

run(qobj, job_name=None, job_share_level=None, job_tags=None, validate_qobj=False)[소스]

Run a Qobj asynchronously.

매개변수
  • qobj (Union[QasmQobj, PulseQobj]) – The Qobj to be executed.

  • job_name (Optional[str]) – Custom name to be assigned to the job. This job name can subsequently be used as a filter in the jobs() method. Job names do not need to be unique.

  • job_share_level (Optional[str]) –

    Allows sharing a job at the hub, group, project, or global level. The possible job share levels are: global, hub, group, project, and none.

    • global: The job is public to any user.

    • hub: The job is shared between the users in the same hub.

    • group: The job is shared between the users in the same group.

    • project: The job is shared between the users in the same project.

    • none: The job is not shared at any level.

    If the job share level is not specified, the job is not shared at any level.

  • job_tags (Optional[List[str]]) – Tags to be assigned to the jobs. The tags can subsequently be used as a filter in the jobs() function call.

  • validate_qobj (bool) – If True, run JSON schema validation against the submitted payload

반환 형식

IBMQJob

반환값

The job to be executed, an instance derived from BaseJob.

예외
status()[소스]

Return the backend status.

반환 형식

BackendStatus

반환값

The status of the backend.

예외

IBMQBackendApiProtocolError – If the status for the backend cannot be formatted properly.

version()

Return the backend version.

반환값

the X.X.X version of the backend.

반환 형식

str

당신은 다음 언어로 문서를 보고 있다 lang: Korean
언어
English
Japanese
German
Korean