def __init__(self): # TODO change netname when name change NodeManager.__init__(self) odfilepath = self.GetSlaveODPath() if(os.path.isfile(odfilepath)): self.OpenFileInCurrent(odfilepath) else: self.FilePath = "" dialog = CreateNodeDialog(None, wx.OK) dialog.Type.Enable(False) dialog.GenSYNC.Enable(False) if dialog.ShowModal() == wx.ID_OK: name, id, nodetype, description = dialog.GetValues() profile, filepath = dialog.GetProfile() NMT = dialog.GetNMTManagement() options = dialog.GetOptions() self.CreateNewNode(name, # Name - will be changed at build time id, # NodeID - will be changed at build time "slave", # Type description,# description profile, # profile filepath, # prfile filepath NMT, # NMT options) # options else: self.CreateNewNode("SlaveNode", # Name - will be changed at build time 0x00, # NodeID - will be changed at build time "slave", # Type "", # description "None", # profile "", # prfile filepath "heartbeat", # NMT []) # options dialog.Destroy() self.OnCTNSave()
def __init__(self, parent, filepath, fullname): NodeManager.__init__(self) self.OpenFileInCurrent(filepath) self.Parent = parent self.Fullname = fullname
def __init__(self): # TODO change netname when name change NodeManager.__init__(self) odfilepath = self.GetSlaveODPath() if os.path.isfile(odfilepath): self.OpenFileInCurrent(odfilepath) else: self.FilePath = "" dialog = CreateNodeDialog(None, wx.OK) dialog.Type.Enable(False) dialog.GenSYNC.Enable(False) if dialog.ShowModal() == wx.ID_OK: name, id, _nodetype, description = dialog.GetValues() profile, filepath = dialog.GetProfile() NMT = dialog.GetNMTManagement() options = dialog.GetOptions() self.CreateNewNode(name, # Name - will be changed at build time id, # NodeID - will be changed at build time "slave", # Type description, # description profile, # profile filepath, # prfile filepath NMT, # NMT options) # options else: self.CreateNewNode("SlaveNode", # Name - will be changed at build time 0x00, # NodeID - will be changed at build time "slave", # Type "", # description "None", # profile "", # prfile filepath "heartbeat", # NMT []) # options dialog.Destroy() self.OnCTNSave()
def main(): params, nw = nm.localParams() with open('pwf', 'r') as p: password = p.read() password = password.rstrip() jobs = [] msg = None r = multiprocessing.Process( target=logMonitor_Tx(msg, params, password, nw)) jobs.append(r) r.start()
def __init__(self, parent, *args, **kwargs): NodeManager.__init__(self, *args, **kwargs) self.Parent = parent
from nodemanager import NodeManager from multiprocessing import Process, Queue if __name__ == '__main__': url_q = Queue() result_q = Queue() store_q = Queue() conn_q = Queue() page_q = Queue() data_q = Queue() for i in range(1, 10): page_q.put(i) # 创建分布式管理器 node = NodeManager() manager = node.start_Manager(url_q, result_q, page_q, data_q) # 创建URL管理进程、 数据提取进程和数据存储进程 url_manager_proc = Process(target=node.url_manager_proc, args=( url_q, conn_q, 'https://www.renrenche.com/nc/ershouche/p1', )) result_solve_proc = Process(target=node.result_solve_proc, args=(result_q, conn_q, store_q, data_q)) store_proc = Process(target=node.store_proc, args=(store_q, )) # 启动3个进程和分布式管理器 url_manager_proc.start() result_solve_proc.start() store_proc.start() manager.get_server().serve_forever()