Threadsafe decorators
patient_find(num_tries, patience)
Kosh "find" methods can sometimes return empty results when they shouldn't. It's really unclear why/how this happens. This decorator allows us to perform the search multiple times if the initial results are empty.
Parameters:
num_tries: int The number of allowable attempts. patience: float The number of seconds to wait between tries.
Returns:
A version of the "find" function that will re-attempt the find if the initial results are empty.
Source code in kosh/threadsafe_decorators.py
threadsafe_call(num_tries, patience)
A custom thread lock decorator made specifically for Kosh calls.
Parameters:
num_tries: int The number of allowable attempts. patience: float The number of seconds to wait between tries.
Returns:
A threadsafe version of the decorated function.