qiskit_serverless.core.IBMServerlessClient

class IBMServerlessClient(token=None, name=None)[source]

A client for connecting to the IBM serverless host.

Credentials can be saved to disk by calling the save_account() method:

from qiskit_serverless import IBMServerlessClient
IBMServerlessClient.save_account(token=<INSERT_IBM_QUANTUM_TOKEN>)

Once the credentials are saved, you can simply instantiate the client with no constructor args, as shown below.

from qiskit_serverless import IBMServerlessClient client = IBMServerlessClient()

Instead of saving credentials to disk, you can also set the environment variable ENV_GATEWAY_PROVIDER_TOKEN and then instantiate the client as below:

from qiskit_serverless import IBMServerlessClient
client = IBMServerlessClient()

You can also enable an account just for the current session by instantiating the provider with the API token:

from qiskit_serverless import IBMServerlessClient
client = IBMServerlessClient(token=<INSERT_IBM_QUANTUM_TOKEN>)

Initialize a client with access to an IBMQ-provided remote cluster.

If a token is used to initialize an instance, the name argument will be ignored.

If only a name is provided, the token for the named account will be retrieved from the user’s local IBM Quantum account config file.

If neither argument is provided, the token will be searched for in the environment variables and also in the local IBM Quantum account config file using the default account name.

Parameters:
  • token (Optional[str]) – IBM quantum token

  • name (Optional[str]) – Name of the account to load

__init__(token=None, name=None)[source]

Initialize a client with access to an IBMQ-provided remote cluster.

If a token is used to initialize an instance, the name argument will be ignored.

If only a name is provided, the token for the named account will be retrieved from the user’s local IBM Quantum account config file.

If neither argument is provided, the token will be searched for in the environment variables and also in the local IBM Quantum account config file using the default account name.

Parameters:
  • token (Optional[str]) – IBM quantum token

  • name (Optional[str]) – Name of the account to load

Methods

__init__([token, name])

Initialize a client with access to an IBMQ-provided remote cluster.

context(**kwargs)

Allocated context for selected compute_resource for provider.

create_compute_resource(resource)

Create compute resource for provider.

delete_compute_resource(resource)

Delete compute resource for provider.

download(file[, download_location])

Download file.

file_delete(file[, provider])

Deletes file uploaded or produced by the programs,

file_download(file[, target_name, ...])

Download file.

file_upload(file[, provider])

Upload file.

files([provider])

Returns list of available files produced by programs to download.

from_dict(dictionary)

Converts dict to object.

get(title[, provider])

Returns qiskit function based on title provided.

get_compute_resources()

Return compute resources for provider.

get_job_by_id(job_id)

Returns job by job id.

get_jobs(**kwargs)

Return list of jobs.

get_programs(**kwargs)

[Deprecated] Returns list of available programs.

job_client()

Return job client for configured compute resource of provider.

list(**kwargs)

Returns list of available programs.

run(program[, arguments, config])

Execute a program as a async job.

save_account([token, name, overwrite])

Save the account to disk for future use.

to_dict()

Converts class to dict.

upload(program)

Uploads program.

widget()

Widget for information about provider and jobs.