hvl_ccb.utils.poller
digraph inheritance67f10ca3fb { bgcolor=transparent; rankdir=TB; size=""; "Poller" [URL="../hvl_ccb.utils.poller.html#hvl_ccb.utils.poller.Poller",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Poller class wrapping `concurrent.futures.ThreadPoolExecutor` which enables passing"]; }- class Poller(spoll_handler: Callable, polling_delay_sec: int | float = 0, polling_interval_sec: int | float = 1, polling_timeout_sec: int | float | None = None)[source]
Bases:
object
Poller class wrapping concurrent.futures.ThreadPoolExecutor which enables passing of results and errors out of the polling thread.
- is_polling() bool [source]
Check if device status is being polled.
- Returns:
True when polling thread is set and alive
- start_polling() bool [source]
Start polling.
- Returns:
True if was not polling before, False otherwise
- stop_polling() bool [source]
Stop polling.
Wait for until polling function returns a result as well as any exception / error that might have been raised within a thread.
- Returns:
True if was polling before, False otherwise, and last result of the polling function call.
- Raises:
polling function exceptions