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
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)
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
Represents a “subscriber”.
Every component (class) can become a Subscriber
and subscribe to events, that will call callback functions when they are emitted.
clear
subscribe
subscribe(event, callback)
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)
Unsubscribe a pair event-callback, so the callback will not be called anymore when the event occurs.
Return type
bool