def main(): build_tool_list() tooldb_tools(TOOLS.keys()) tooldb_callbacks(get_tool, put_tool, load_spindle, unload_spindle) try: tooldb_loop() # loop forever, use callbacks except Exception as e: PLASMADB.terminate() if sys.stdin.isatty(): print(("exception=", e)) else: pass # avoid messages at termination PLASMADB.terminate()
def __init__(self): super(DataBaseManager, self).__init__() self.session = None Base.metadata.create_all(engine) self.session = Session() tools = self.session.query(Tool).all() tool_list = list() for tool in tools: tool_list.append(tool.tool_no) tooldb_tools(tool_list) tooldb_callbacks(self.user_get_tool, self.user_put_tool, self.user_load_spindle, self.user_unload_spindle) self.tool_list = tool_list self.tools = dict()
tools[key] = params.upper() # sync to host if debug: sys.stderr.write("@@user_put_tool_nonran_tc: %s\n" % tools[key]) save_tools_to_file(db_savefile) #----------------------------------------------------------- # begin debug = 0 # debug var for command line testing if (len(sys.argv) > 1 and sys.argv[1] == 'debug'): debug = 1 toolno_min = 10 toolno_max = 19 make_tools(toolno_min, toolno_max) if random_toolchanger: tooldb_callbacks(user_get_tool, user_put_tool_ran_tc) else: tooldb_callbacks(user_get_tool, user_put_tool_nonran_tc) toollist = list(range(toolno_min, toolno_max + 1)) if random_toolchanger: toollist.append(0) # T0 provision tooldb_tools(toollist) try: tooldb_loop() # loop forever, use callbacks except Exception as e: if sys.stdin.isatty(): print(("exception=", e)) else: pass # avoid messages at termination