parser.add_argument("pattern") args = parser.parse_args() def timer_cb(h, watcher, revents, _arg): print("Timeout!", file=sys.stderr) h.reactor_stop_error() def dmesg_cb(rpc, pattern, verbose=False): buf = rpc.get_str() match = pattern.search(buf) if match: print(buf) rpc.flux_handle.reactor_stop() elif verbose: print(buf) rpc.reset() pattern = re.compile(args.pattern) h = flux.Flux() rpc = h.rpc("log.dmesg", {"follow": True}, flags=FLUX_RPC_STREAMING) rpc.then(dmesg_cb, pattern, verbose=args.verbose) TimerWatcher(h, args.timeout, timer_cb).start() if h.reactor_run() < 0: sys.exit(1)
def timer_watcher_create(self, after, callback, repeat=0.0, args=None): from flux.core.watchers import TimerWatcher return TimerWatcher(self, after, callback, repeat=repeat, args=args)
def timer_watcher_create(self, after, callback, repeat=0.0, args=None): return TimerWatcher(self, after, callback, repeat=repeat, args=args)