def process_input(command_string): if (command_string == ""): return if (command_string == "q"): sys.exit() daq_lib.broadcast_output(time.ctime(time.time()) + "\n" + command_string) try: daq_lib.set_field("program_state","Program Busy") execute_command(command_string) except NameError as e: error_string = "Unknown command in queue: %s Error: %s" % (command_string, e) logger.error(error_string) exc_type, exc_value, exc_traceback = sys.exc_info() print("*** print_tb:") traceback.print_tb(exc_traceback, limit=1, file=sys.stdout) except SyntaxError: logger.error("Syntax error") except KeyError as e: logger.error("Key error. Error: %s. Command was: %s" % (e, command_string)) except TypeError as e: logger.error("Type error. Error: %s" % e) except AttributeError as e: logger.error("Attribute Error: %s" % e) except KeyboardInterrupt: abort_data_collection() logger.info("Interrupt caught by daq server\n") if (command_string != "pause_data_collection()" and command_string != "continue_data_collection()" and command_string != "abort_data_collection()" and command_string != "unmount_after_abort()" and command_string != "no_unmount_after_abort()"): daq_lib.set_field("program_state","Program Ready")
def process_input(command_string): if command_string == "": return # daq_utils.broadcast_output(time.ctime(time.time())) if command_string == "q": sys.exit() daq_lib.broadcast_output(time.ctime(time.time()) + "\n" + command_string) try: daq_lib.set_field("program_state", "Program Busy") execute_command(command_string) except NameError: error_string = "Unknown command: " + command_string print error_string except SyntaxError: print "Syntax error" except KeyError: print "Key error" except TypeError: print "Type error" except KeyboardInterrupt: abort_data_collection() print "Interrupt caught by daq server\n" if ( command_string != "pause_data_collection()" and command_string != "continue_data_collection()" and command_string != "abort_data_collection()" and command_string != "unmount_after_abort()" and command_string != "no_unmount_after_abort()" ): daq_lib.set_field("program_state", "Program Ready")
def hi_macro(): print "hello from macros\n" daq_lib.broadcast_output("broadcast hi")