def __init__(self, mysql_config, table_name, engine_id, engine_type, queue_ip, queue_start_name, queue_result_name, update_interval=60): self.mysql_handle = MysqlHandleBase(mysql_config['host'], mysql_config['user'], mysql_config['password'], mysql_config['db']) self.table_name = table_name self.engine_type = engine_type self.update_interval = update_interval self.where_fields = {'engine_id': [engine_id, 's']} self.register_fields = { 'engine_id': [engine_id, 's'], 'ip': [getLocalIp(), 's'], 'engine_type': [engine_type, 's'], 'queue_ip': [queue_ip, 's'], 'queue_start_name': [queue_start_name, 's'], 'queue_result_name': [queue_result_name, 's'], 'status': [1, 's'], 'time': [get_format_time(), 's'] } self.update_fields = {}
def main(): urlfile, directory, url = 'urls', 'share',getLocalIp() if not os.path.exists('share'): os.makedirs('share') client = Client('http://%s:4242' % url, directory, urlfile) client.MainLoop()
def __init__(self, config_name='test_engine_conf.yaml'): super(Engine_Model, self).__init__() self.config_name = config_name self.CURRENT_PATH = sys.path[0] self.read_config_public() self.engine_id = hash_md5(getLocalIp() + self.engine_type + self.CURRENT_PATH) self.mq = multiprocessing.Queue() self.lock = multiprocessing.Lock() self.start_server_heart_beat()
def OnInit(self): win = wx.Frame(None, title="File Share Tool",size=(800,600)) bkg = wx.Panel(win) self.urlinput = urlinput = wx.TextCtrl(bkg, -1, 'code the remote ip here', size = (200,25)) self.statusBar = win.CreateStatusBar() url_text = wx.StaticText(bkg, -1, 'remote URL:', size=(1, 25)) self.localip_text = localip_text = wx.StaticText(bkg, -1, 'Local IP:%s' % getLocalIp(),size=(200,20)) submit = wx.Button(bkg, label="Fetch",size=(80,25)) submit.Bind(wx.EVT_BUTTON, self.getRemoteResource) hbox = wx.BoxSizer() hbox.Add(localip_text, proportion=1, flag=wx.ALL, border = 10) hbox.Add(url_text, proportion=1,flag=wx.ALL, border=10) hbox.Add(urlinput, proportion=1,flag=wx.ALL | wx.ALIGN_RIGHT, border=10) hbox.Add(submit, flag=wx.TOP | wx.BOTTOM | wx.RIGHT, border=10) self.files = files = wx.ListBox(bkg,size=(350,400)) self.remotefiles = remotefiles = wx.ListBox(bkg,size=(350,400)) self.remotefiles.Bind(wx.EVT_LISTBOX_DCLICK, self.listDClick) vbox = wx.BoxSizer(wx.VERTICAL) vbox.Add(hbox, proportion=0, flag=wx.EXPAND) hbox2 = wx.BoxSizer() hbox2.Add(remotefiles,proportion=1, flag=wx.ALL | wx.EXPAND, border=10) hbox2.Add(files, proportion=1,flag=wx.ALL | wx.EXPAND, border=10) vbox.Add(hbox2,proportion=0, flag=wx.EXPAND) hbox3 = wx.BoxSizer() link = wx.lib.hyperlink.HyperLinkCtrl(parent = bkg, pos = (225, 60)) link.SetURL(URL = "http://www.the5fire.net") link.SetLabel(label = u"访问作者博客") link.SetToolTipString(tip = "the5fire") hbox3.Add(link, proportion = 0, flag = wx.EXPAND | wx.TOP, border = 10) vbox.Add(hbox3, proportion = 0, flag = wx.EXPAND) bkg.SetSizer(vbox) win.Show() self.updateList() return True