def prepareThreads(): global threads dbproxy.DBCommand.comList = dbCommands threads[Processes.BasicIO] = basicio.BasicIO( currInfo["port"],int(currInfo["baudrate"]), queues[Queues.XBeeInput],queues[Queues.XBeeOutput],flags[Processes.BasicIO]) threads[Processes.Processing] = processing.DataHandler(queues[Queues.XBeeInput],queues[Queues.ProcessingOutput],flags[Processes.Processing]) threads[Processes.Distribution] = distributor.Distributor(queues[Queues.ProcessingOutput], queues[Queues.DatabaseInput],queues[Queues.FirstFileInput],queues[Queues.SecondFileInput], flags[Processes.Distribution],curSession) threads[Processes.DatabaseIO] = dbproxy.DataBaseWorker(currInfo["host"],currInfo["user"],currInfo["password"],currInfo["schema"], queues[Queues.DatabaseInput],queue.Queue(),flags[Processes.DatabaseIO]) threads[Processes.FileIO] = (fileio.FileIO("out(1).csv",queues[Queues.FirstFileInput],flags[Processes.FileIO]), fileio.FileIO("out(2).csv",queues[Queues.SecondFileInput],flags[Processes.FileIO]))
# sID = input("Input session id: ") sID = 8 sName = "" #sName = input("Input session name: ") ses = session.Session(sID,sName) expOut = fileio.FileIO("log.txt",fileOutput,flag.Flag()) expHandler = exceptionhandler.ExceptionHandler(exceptionOutput,fileOutput) processing.DataHandler.setErrorLog(exceptionOutput) distributor.Distributor.setErrorLog(exceptionOutput) dbproxy.DataBaseWorker.setErrorLog(exceptionOutput) fileio.FileIO.setErrorLog(exceptionOutput) xbeeWorker = basicio.BasicIO("COM6",9600,queues[Queues.XBeeInput],queues[Queues.XBeeOutput],flags[Processes.BasicIO]) process = processing.DataHandler(queues[Queues.XBeeOutput],queues[Queues.ProcessingOutput],flags[Processes.Processing]) distrib = distributor.Distributor(queues[Queues.ProcessingOutput],queues[Queues.DatabaseInput],queues[Queues.FirstFileInput],queues[Queues.SecondFileInput],flags[Processes.Distribution],ses) dbWorker = dbproxy.DataBaseWorker(host,uid,passw,schema,queues[Queues.DatabaseInput],queue.Queue(100),flags[Processes.DatabaseIO]) fWorkerf = fileio.FileIO("output(1).csv",queues[Queues.FirstFileInput],flags[Processes.FileIO]) fWorkers = fileio.FileIO("output(2).csv",queues[Queues.SecondFileInput],flags[Processes.FileIO]) interface = CUI(ses,flags,queues) process.start() distrib.start() dbWorker.start() fWorkerf.start() fWorkers.start() expOut.start() expHandler.start()