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.

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.

filtered_logs(job_id, **kwargs)

Returns logs of the job.

from_dict(dictionary)

Converts dict to object.

function(title[, provider])

Returns program based on parameters.

functions(**kwargs)

Returns list of available programs.

get(title[, provider])

Returns program based on parameters.

get_job_by_id(job_id)

Returns job by job id.

get_jobs(**kwargs)

Return list of jobs.

job(job_id)

Returns job by job id.

jobs(**kwargs)

Return list of jobs.

list(**kwargs)

Returns list of available programs.

logs(job_id)

Return logs.

result(job_id)

Return results.

run(program[, arguments, config, provider])

Run a function and return its job.

save_account([token, name, overwrite])

Save the account to disk for future use.

status(job_id)

Check status.

stop(job_id[, service])

Stops job/program.

to_dict()

Converts class to dict.

upload(program)

Uploads program.

widget()

Widget for information about provider and jobs.