def update(self): fact = get_next_fact_noblock(self.factspace, self.type_) if matches(fact, self.criteria): self.count+=1 return fact else: return False
if bytes_to_read == 0: return with open(log_file.path, 'r') as f: f.seek(-bytes_to_read, SEEK_END) log_data = f.read(MAX_FACT_SIZE) content = {'component': log_file.component, 'type': log_file.type, 'file': log_file.path, 'data': log_data} if not store_fact('kropotkin', 'log_data', content): stderr.write("Could not store log_data\n") log_file.position += len(log_data) subscribe('kropotkin', 'fact', 'component_deployed') component_facts = get_all_facts('kropotkin', 'component_deployed', {}) map(store_component_log_files, filter(should_check_component, component_facts)) while True: target_end = time() + POLL_INTERVAL component_fact = get_next_fact_noblock('kropotkin', 'component_deployed') if component_fact and should_check_component(component_fact): store_component_log_files(component_fact) map(check_log_file, LOG_FILES) time_left = target_end - time() if time_left > 0: sleep(time_left)