def init_c(arg, common): arg['in_queue'] = common['c_queue'] arg['count_timer'] = int(timer()) arg['count'] = 0 arg['monit_message'] = Message(destination=MONITOR, subject='C_message') arg['monit_timer'] = timer() return None
def main_s(arg, common): if timer() > arg['timer']: arg['timer'] = timer() message = Message(destination=b'C', data=timer(), skip_serialize=True, timeout=1) result = send_request(common, message) #temp = result.retrieve() #print 'S received', [temp] if timer() > arg['monit_timer']: send_message(common, arg['monit_message']) arg['monit_timer'] = timer() + 2 sleep(0.0001) return None
def main_c(arg, common): if timer() > arg['timer']: work_message = Message(destination=b'S', data=timer(), skip_serialize=True, timeout=1) result = send_request(common, work_message) temp_message = result.get() print('Main_c received', temp_message) log_message = LogMessage(log_level=INFO, log_message='C message', log_details=temp_message.data) send_log_message(arg, common, log_message) arg['timer'] = timer() + 1 sleep(0.1) return None
def main_c(arg, common): try: temp_message = arg['in_queue'].get(timeout=1) #print 'Main_c received', temp_message log_message = LogMessage(log_level=INFO, log_message='C message', log_details=temp_message.data) send_log_message(arg, common, log_message) response_message = Message(data=timer() - temp_message.data) send_response(common, temp_message, response_message) if int(timer()) != arg['count_timer']: print(arg['count']) arg['count_timer'] = int(timer()) arg['count'] = 0 else: arg['count'] += 1 except Empty: print('main_c') if timer() > arg['monit_timer']: send_message(common, arg['monit_message']) arg['monit_timer'] = timer() + 2 return None
def init_c(arg, common): arg['in_queue'] = common['c_queue'] arg['timer'] = timer() return None
def init_s(arg, common): arg['timer'] = timer() arg['monit_message'] = Message(destination=MONITOR, subject='S_message') arg['monit_timer'] = timer() return None