fermioniq.client.Client#
- class fermioniq.client.Client(access_token_id: str | None = None, access_token_secret: str | None = None, polling_interval: float = 1.0, verbosity_level: int = 0)#
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 provides polling functionality for subscribing to job events and receiving updates about job status changes. 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.
- polling_interval
The interval in seconds between polling requests. Defaults to 1 second.
- 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.
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.
Retrieve all available noise models.
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 status changes and execute a callback function when status changes.
Stop polling for job updates.