Skip to main contentIBM Quantum Documentation
Qiskit IBM Provider is deprecated. See the migration guide to use Qiskit Runtime.

Utilities

qiskit_ibm_provider.utils

Utility functions related to the IBM Quantum Provider.


Conversion

seconds_to_duration(seconds)Converts seconds in a datetime delta to a duration.
utc_to_local(utc_dt)Convert a UTC datetime object or string to a local timezone datetime.

Misc Functions

to_python_identifier(name)Convert a name to a valid Python identifier.
validate_job_tags(job_tags, exception)Validates input job tags.

Publisher/subscriber model

Message broker for the Publisher / Subscriber mechanism

Publisher

class Publisher

GitHub(opens in a new tab)

Represents a “publisher”.

Every component (class) can become a Publisher and send events by inheriting this class. Functions can call this class like:

Publisher().publish("event", args, ... )

publish

publish(event, *args, **kwargs)

GitHub(opens in a new tab)

Triggers an event, and associates some data to it, so if there are any subscribers, their callback will be called synchronously.

Return type

None

Subscriber

class Subscriber

GitHub(opens in a new tab)

Represents a “subscriber”.

Every component (class) can become a Subscriber and subscribe to events, that will call callback functions when they are emitted.

clear

clear()

GitHub(opens in a new tab)

Unsubscribe everything

Return type

None

subscribe

subscribe(event, callback)

GitHub(opens in a new tab)

Subscribes to an event, associating a callback function to that event, so when the event occurs, the callback will be called.

This is a blocking call, so try to keep callbacks as lightweight as possible.

Return type

bool

unsubscribe

unsubscribe(event, callback)

GitHub(opens in a new tab)

Unsubscribe a pair event-callback, so the callback will not be called anymore when the event occurs.

Return type

bool

Was this page helpful?
Report a bug or request content on GitHub.