added state api
This commit is contained in:
@@ -22,6 +22,11 @@ T = TypeVar('T')
|
||||
|
||||
|
||||
class StateChecker(Generic[T]):
|
||||
"""
|
||||
This class is designed generically to regularly check the state of objects with given function(s).
|
||||
The determined state is stored "locally" in the state checker object and NOT reflected back to the checked objects!
|
||||
It can be retrieved by calling get_current_state.
|
||||
"""
|
||||
def __init__(self, state_checker_func: Union[Callable, List[Callable]], type_to_check: T, type_name=None,
|
||||
threads=NUM_THREADS):
|
||||
self.num_threads = threads
|
||||
@@ -135,7 +140,6 @@ class StateChecker(Generic[T]):
|
||||
'previous': {'state_ok': self.state_results[o_s]['state_ok'],
|
||||
'msg': self.state_results[o_s].get('msg', None),
|
||||
'time_stamp': self.state_results[o_s].get('time_stamp', None)}}
|
||||
pass
|
||||
else:
|
||||
self.state_results[o_s] = object_states[o_s]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user