fermioniq.client.Client#

class fermioniq.client.Client(access_token_id: str | None = None, access_token_secret: str | None = None, verbosity_level: int = 0, ws_event_loop: AbstractEventLoop | None = None)#

This class provides an interface to interact with the Fermioniq API.

It allows users to schedule, manage, and retrieve the results of fermioniq.emulator_job.EmulatorJob() objects. Additionally, it provideswebsocket functionality for subscribing to job events and receiving updates in real-time. The class handles token management, ensuring that a valid token is always used when interacting with the API.

Parameters:
access_token_id

API Key. Can be overwritten with environment variable FERMIONIQ_ACCESS_TOKEN_ID.

access_token_secret

API Secret. Can be overwritten with environment variable FERMIONIQ_ACCESS_TOKEN_SECRET.

ws_event_loop

The event loop to be used by the Fermioniq class. If set to None, a new event loop will be created. Users can provide their own event loop if desired.

verbosity_level

Level of Client verbosity. The higher the number, the more emulator output will be sent to the client. This has an impact on runtime performance and costs.

Raises:
RuntimeError

If access_token_id or access_token_secret are not provided and are not found in the environment variables.

Examples

>>> fermioniq = Client()
>>> # Schedule a new job
>>> job = EmulatorJob(circuit="some_circuit_definition")
>>> job_response = fermioniq.schedule_async(job)
>>> # Retrieve a specific job
>>> job_response = fermioniq.job(job_id="some_job_id")
>>> # Retrieve all jobs
>>> jobs_list = fermioniq.jobs()
>>> # Subscribe to job events
>>> fermioniq.subscribe_to_events(job_id="some_job_id", on_msg_callback=my_callback)

Methods

cancel(job_id)

Cancels a job.

configure_notifications([slack_id, ...])

Configure email address and/or Slack ID.

delete(job_id)

Deletes job given by id.

get_job_data_download_url(job_id)

Returns a download url for retrieving the job data package.

get_projects()

Retrieve all projects.

get_results(job_id)

Retrieve the job results if available.

get_status(job_id)

Retrieve the status of the job with id job_id.

job(job_id)

Retrieve the job with the specified job_id.

jobs([offset, limit])

Retrieve all jobs.

noise_models()

Retrieve all available noise models.

remote_configs()

Retrieve all remote configurations.

schedule_and_wait(job[, logger, ...])

Schedule a new job and wait for it to finish.

schedule_async(job)

Schedule a new job asynchronously.

subscribe_to_events(job_id[, ...])

Subscribe to job events and execute a callback function when a new message is received.

unsubscribe