pylab_ml.base_instrument.TimeoutBudget

class TimeoutBudget(*args, **kwargs)[source]

Bases: object

This 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
__init__()[source]

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

set_slack(instrument, need=None)[source]

add needed delay to whats left of the accumulated timeout to given instrument.inst.timeout

slack()[source]

Seconds remaining of accumulated timeout, lower limit at minim