pylab_ml.base_instrument.TimeoutBudget
- class TimeoutBudget(*args, **kwargs)[source]
Bases:
objectThis TimeoutBudget class is a singleton to provide a shared budget object within each Instrument object.
Allowing each instrument transaction to accumulate timeout for their needs, which gradually bleeds away as time elapses
Example
>>> instrument.budget = TimeoutBudget() >>> instrument.budget.cut_slack(instrument, 3) add 3sec delay to whats left of the accumulated timeout to instrument.inst.timeout >>> instrument.budget.cut_slack(instrument) add minimal delay to whats left of the accumulated timeout to instrument.inst.timeout
Methods
__init__()cut_slack(need)Add needed delay to whats left of the accumulated timeout
set_slack(instrument[, need])Add needed delay to whats left of the accumulated timeout to given instrument.inst.timeout
slack()Seconds remaining of accumulated timeout, lower limit at minim
- cut_slack(need)[source]
Add needed delay to whats left of the accumulated timeout
- Parameters:
need (float) – The additional time in seconds to add to the accumulated timeout.
- Returns:
The total time in seconds to wait, which is the sum of the remaining slack time, the needed time, and the relaxation time.
- Return type:
float
- set_slack(instrument, need=None)[source]
Add needed delay to whats left of the accumulated timeout to given instrument.inst.timeout
- Parameters:
instrument (Instrument) – The instrument object whose timeout will be adjusted.
need (float, optional) – The additional time in seconds to add to the accumulated timeout. Default is 0.2 seconds.