• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python mrflog.warn函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中mrflog.mrflog.warn函数的典型用法代码示例。如果您正苦于以下问题:Python warn函数的具体用法?Python warn怎么用?Python warn使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了warn函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: cmd_mrfctrl

    def cmd_mrfctrl(self,data,wsid):
        mrflog.warn( "cmd_mrfctrl here, data was %s"%repr(data))

        if data['tab'] != self.graphid:
            return




        if data['row'] == 'days':
            self.days = int(data['value'])
        elif data['row'] == 'type':
            self.graph_type = data['value']

        if self.graph_type == 'Ambient':
            sensor_ids=["LOUNGE_AMBIENT","OUTSIDE_AMBIENT"]
        elif self.graph_type == 'Store':
            sensor_ids=["ACC_100","ACC_60","ACC_30","ACC_RET"]
        else:
            sensor_ids=["ACC_100","ACC_60","ACC_30","OUTSIDE_AMBIENT"]


        docdate = datetime.datetime.combine(datetime.datetime.now().date(),datetime.time())

        self.rm.db_days_graph(sensor_ids=sensor_ids,stype='temp',docdate=docdate,wsid=wsid, wtag=self.graphtag(self.graphid),days=self.days)
开发者ID:ReallyGnusys,项目名称:mrfbus,代码行数:25,代码来源:mrfland_weblet_history.py


示例2: time_tick

    def time_tick(self):

        if self._active:
            mrflog.info("time_tick active");
            if self.active_cmd == None:
                mrflog.info("tick can run another cmd")
            else:
                mrflog.info("time_tick active resp_timer %d"%self.resp_timer)
                self.resp_timer += 1
                if self.resp_timer > 7:
                    mrflog.warn("give up waiting for response for %s"%( self.active_cmd))
                    if hasattr(self,'tcp_server') and self.tcp_server.tag_is_tcp_client(self.active_cmd.tag):
                        mrflog.info("response for tcp client %d"%self.active_cmd.tag)
                        mrflog.info("sending empty dict")
                        rstr = mrfland.to_json({})
                        self.tcp_server.write_to_client(self.active_cmd.tag,rstr)
                    self.active_cmd = None


            if self.active_cmd == None:
                self._check_if_anything()



        if self._active:
            self._set_timeout(0.1)
            self.quiet_cnt = 0
        else:
            mrflog.info("inactive - setting 5 secs - quiet_cnt %d"%self.quiet_cnt)
            self.quiet_cnt += 1
            self._set_timeout(5.0)
            if self.quiet_cnt % 5 == 0  :
                #mrflog.info("calling state task qc %d"%self.quiet_cnt)
                self.rm.quiet_task()
                self.quiet_cnt = 0
开发者ID:ReallyGnusys,项目名称:mrfbus,代码行数:35,代码来源:mrfland_server.py


示例3: setserver

    def setserver(self,server):  # OUCH , we let the server set a reference to itself..for now
        self.server = server   # Please only let a mrfland_server or subclass ever call this function
        ## run postinit
        for wtag in self.weblets.keys():
            wl = self.weblets[wtag]
            if hasattr( wl, 'run_init'):
                mrflog.warn( "calling run_init for weblet %s "%wtag)
                getattr(wl, 'run_init')()
        ## rm should connect graph callbacks here
        """ regmanager now keeps history for registered sensors """
        self.shist = {}
        self.shist_ts = []
        self.shist_start_time = time.time()  ## should be consistent with self.shist_ts[0]
        self.shist_last_time = self.shist_start_time ## last time reading arrived
        for sl in self.sgraphs.keys():
            mrflog.warn("graph subscribe %s"%sl)
            flds = self.sgraphs[sl]
            self.shist[sl] = {}
            for fld in flds:
                self.shist[sl][fld] = []

            #self.sensors[sl].subscribe_minutes(self.graph_callback)

        # get sensors that have data in db
        if hasattr(self,'db'):
            tornado.ioloop.IOLoop.current().run_sync(lambda: self.db_get_sensors())

        ## start minute tick

        self.server.start_minute_tick(0,self._minute_tick)
开发者ID:ReallyGnusys,项目名称:mrfbus,代码行数:30,代码来源:mrfland_regmanager.py


示例4: __init__

    def __init__(self,config):
        self.labels = {}
        self.devices = {}  ### hash devices by label - must be unique
        self.devmap  = {} ## hash devices by address
        self.sensors = {}  ### hash sensors by label
        self.senstypes = {} ### hash lists of sensors by sensor type
        self.senscaps = {}  ## hash lists by cap string
        self.actuators = {}
        self.sensmap = {}  ## keep physical mapping here - addr, chan dict returned for each sensor label
        self.addresses = {}  ### hash devices by address - must be unique
        self.wups = []  ## webupdates from weblets to send to browsers
        self.dups = []  ## device updates : from weblets to send to devices
        self.hostname = socket.gethostname()
        self.weblets = OrderedDict()  # has weblets by tag
        self.timers = {}
        self.sgraphs = {}  # support graph data for these sensors during this mrfland session
        self.graph_insts = 0
        self.config = config
        self.comm = mrf_comm(log=mrflog)
        if self.config.has_key('db_uri') and type(self.config['db_uri'])==type("") and self.config['db_uri'] != "":
            from motor import motor_tornado
            self.db = motor_tornado.MotorClient(self.config['db_uri']).mrfbus
            mrflog.warn("opened db connection %s"%repr(self.db))

        self.server = None
开发者ID:ReallyGnusys,项目名称:mrfbus,代码行数:25,代码来源:mrfland_regmanager.py


示例5: pane_html

    def pane_html(self):

        s = """<hr>
        <div>
        """
        s += mrfctrl_select_html(self.tag,self.graphid, 'days', ['1','7','28'],'Days')
        s += mrfctrl_select_html(self.tag,self.graphid, 'type', ['Ambient','Store','Energy'],'Graph')

        s += """
      </div>
"""

        s += '<div id="'+self.graphid+'"></div>'

        if hasattr(self.rm,'db_sensors'):
            sens = self.rm.db_sensors
            mrflog.warn("pane_html got sensors %s"%repr(sens))
        else:
            sens = None

        if False:  # sens:    FIXME - what is this , generates javascript browser error - NOT VALID!!
            s += """
<script type="text/javascript">
"""+to_json(sens)+"""
</script>

"""
        return s
开发者ID:ReallyGnusys,项目名称:mrfbus,代码行数:28,代码来源:mrfland_weblet_history.py


示例6: cmd_mrfctrl

    def cmd_mrfctrl(self,data, wsid=None):
        mrflog.warn( "cmd_mrfctrl here, data was %s"%repr(data))
        if not data.has_key("tab") or not data.has_key("row"):
            mrflog.error("cmd_mrfctrl data problem in %s"%repr(data))
            return

        if data["tab"] != 'unit_test':
            mrflog.error("weblet devs cmd_mrfctrl tab was not unit_test - got %s"%(repr(data["tab"])))
            return

        dn =  data["row"]

        if not self.test_active.has_key(dn):
            mrflog.error("weblet devs cmd_mrfctrl row %s does not match any devname"%dn)
            return

        if self.test_active[dn]:
            mrflog.warn( "unit_test already active for device  %s"%repr(dn))
            return

        if not self.rm.devices.has_key(dn):
            mrflog.warn( "can't find device  %s registered"%repr(dn))
            return

        tdev = self.rm.devices[dn]
        address = tdev.address

        mrflog.warn( "starting unit_test for device  %s address 0x%x"%(repr(dn),address))





        rv = self.rm.subprocess(['/usr/bin/python', os.path.join(os.environ['MRFBUS_HOME'],'land','test_default.py' ), hex(address)] , self.subproc_callback(dn))
        mrflog.warn("subprocess returned")
开发者ID:ReallyGnusys,项目名称:mrfbus,代码行数:35,代码来源:mrfland_weblet_devs.py


示例7: db_app_load_cfg_data

    def db_app_load_cfg_data(self, **kwargs):

        if not hasattr(self,'db'):
            return

        mrflog.warn("app_data_replace : kwargs %s"%repr(kwargs))
        apptag = kwargs['apptag']





        collname =  '%s.cfg.webapps'%(self.hostname)
        coll = self.db.get_collection(collname)

        filt = {'tag' : apptag }



        future = coll.find_one(filt)
        result = yield future

        mrflog.warn("loaded config  for app %s result %s"%(apptag,repr(result)))

        if result.has_key('data'):
            self.weblets[apptag].restore_cfg(result['data'])
开发者ID:ReallyGnusys,项目名称:mrfbus,代码行数:26,代码来源:mrfland_regmanager.py


示例8: set_timeout

 def set_timeout(self,seconds):
     # start timer
     mrflog.warn("%s : set_timeout seconds  %d  "%(self.__class__.__name__,seconds))
     now = datetime.now()
     td  = timedelta(seconds = seconds)
     tod = now + td
     self.set_timer( tod.time() , 'state' , 'TO')
开发者ID:ReallyGnusys,项目名称:mrfbus,代码行数:7,代码来源:mrfland_weblet_hot_water.py


示例9: run_init

 def run_init(self):
     mrflog.warn("%s run_init"%(self.__class__.__name__))
     # start timer
     now = datetime.now()
     td  = timedelta(seconds = 30)
     tod = now + td
     self.set_timer( tod.time() , 'state' , 'TO')
开发者ID:ReallyGnusys,项目名称:mrfbus,代码行数:7,代码来源:mrfland_weblet_hot_water.py


示例10: pane_html

    def pane_html(self):
        """ just want to display pt1000sens output stucture"""
        
        s =  """
        <h2>"""+self.label+"    "+self.var.tank_top.html+" &#176;C</h2>"
        sensors = []
        for level in self.ts:
            sensors.append(self.ts[level].label)

            
        sensors.append(self.return_sens.label)
         
        s += self.rm.graph_inst({
            "temp" : sensors
        })


        skeys = self.var.__dict__.keys()
        skeys.sort()

        mrflog.warn("store app var keys are %s"%repr(skeys))
        s += """
        <hr>
        <h3>Temps</h3>"""
        s += self.html_var_table(skeys)
            

        

        return s
开发者ID:ReallyGnusys,项目名称:mrfbus,代码行数:30,代码来源:mrfland_weblet_store.py


示例11: var_callback

    def var_callback(self,name,wsid=None):
        if False and self.__class__.__name__ == 'MrfSensMemory':
            mrflog.warn("%s var_callback for %s value %s wsid %s"%(self.__class__.__name__, name, self.var.__dict__[name].val, repr(wsid)))
        else:
            mrflog.debug("%s var_callback for %s value %s wsid %s"%(self.__class__.__name__, name, self.var.__dict__[name].val, repr(wsid)))
        if self.var.__dict__[name].public:  # if set this var has been instanced in a webpage

            mrflog.debug("%s running webupdate for  %s value %s wsid %s"%(self.__class__.__name__, name, self.var.__dict__[name].val, repr(wsid)))


            self.rm.webupdate(self.var.__dict__[name].webtag,
                              { 'val' : self.var.__dict__[name].val}
            )
            self.rm.server._run_updates() # ouch



        # hmpff... see if this var belongs to a timer

        mob = MrflandWeblet._ret.match(name)
        if mob and self._timers.has_key(mob.group(1)):
            tn = mob.group(1)
            mrflog.warn("timer var changed %s  timer %s"%(name,tn))
            self._eval_timer(tn)
            tmr = self._timers[tn]
            if tmr.en.val :   # make sure timers are set
                for act in ['on','off']:
                    aval = tmr.__dict__[act]
                    self.set_timer( aval.tod , tn , act)

        if self.var.__dict__[name].__class__.__name__ == 'MrfWebletConfigVar':
            self._cfg_touched = True
        if hasattr(self,'var_changed'):
            self.var_changed(name,wsid=wsid)
开发者ID:ReallyGnusys,项目名称:mrfbus,代码行数:34,代码来源:mrfland_weblet.py


示例12: restore_cfg

    def restore_cfg(self,data):
        mrflog.warn("weblet %s restoring data %s"%(self.tag,repr(data)))

        for vn in data.keys():
            mrflog.warn("setting var %s to %s"%(vn,repr(data[vn])))
            dv = self.var.__dict__[vn]._val.__class__(data[vn])  # FIXME str types are unicode when they come back from DB
            self.var.__dict__[vn].set(dv)
开发者ID:ReallyGnusys,项目名称:mrfbus,代码行数:7,代码来源:mrfland_weblet.py


示例13: init

    def init(self):
        mrflog.info("%s init"%(self.__class__.__name__))
        # do subscriptions here
        ## looking for all MrfSensPt1000 types

        if not self.rm.senstypes.has_key(MrfSensPt1000):
            mrflog.error("%s post_init failed to find sensor type MrfSensPt1000 in rm"%self.__class__.__name__)
            return
        ts = self.rm.senstypes[MrfSensPt1000]

        mrflog.info("num MrfSensPt1000 found was %d"%len(ts))
        self.slabs = []
        self.sens = OrderedDict()
        if not self.cdata.has_key('acc_tag'):
            mrflog.error("%s , no acc_tag in data")
            return
        if not self.cdata.has_key('acc_litres'):
            mrflog.error("%s , no acc_litres in data")

            return
        self.litres = self.cdata['acc_litres']


        self.top_ts = self.rm.sens_search_vector_max(MrfSensPt1000, self.cdata['acc_tag'])
        self.add_var('tank_top',self.top_ts, field='temp', graph=True)
        self.return_sens = self.rm.sens_search(self.cdata['acc_tag'] + "_RET")        
        self.add_var('return_temp',self.return_sens, field='temp', graph=True)


        self.ts = self.rm.sens_search_vector(MrfSensPt1000, self.cdata['acc_tag'])
        for l in self.ts:  # 
            s = self.ts[l]
            self.add_var(s.label,s, field='temp', graph=True)
  
        mrflog.warn("Store has temp sensors at following levels %s"%repr(self.ts.keys()))
开发者ID:ReallyGnusys,项目名称:mrfbus,代码行数:35,代码来源:mrfland_weblet_store.py


示例14: timer_callback

    def timer_callback(self, app, tag , act):
        mrflog.warn("RegManager timer_callback, app %s tag %s act %s",app, tag,act)

        if not self.weblets.has_key(app):
            mrflog.error("%s timer_callback no app  %s "%(self.__class__.__name__,app, tid,len(self.timers[tid])))
            return
        self.weblets[app]._timer_callback(tag, act)
开发者ID:ReallyGnusys,项目名称:mrfbus,代码行数:7,代码来源:mrfland_regmanager.py


示例15: init

    def init(self):
        mrflog.info("%s init"%(self.__class__.__name__))
        # do subscriptions here
        ## looking for all devs

        dadds = self.rm.devmap.keys()
        mrflog.warn("got dadds %s"%repr(dadds))
        self.devs = OrderedDict()
        dadds.sort()
        self.devnames = []
        for dadd in dadds:
            dev = self.rm.devmap[dadd]
            self.devs[dev.label] = dev
            self.devnames.append(dev.label)
            mrflog.warn("MrfLandWebletDevs added dev label %s add %s"%(dev.label, dev.address))
            self.devs[dev.label].subscribe(self.sens_callback)
        # build prototype output data

        utest = OrderedDict()
        utest['last_run'] = ''
        utest['last_result']   = ''
        self.pod = OrderedDict()
        self.pod['unit_test']   =  utest
        self.pod['dev_info']    =  PktDeviceInfo().dic()
        self.pod['dev_status']  =  PktDeviceStatus().dic()
        self.pod['sys_info']    =  PktSysInfo().dic()
        self.pod['app_info']    =  PktAppInfo().dic()

        self.test_active = {}

        for dn in self.devnames:
            self.test_active[dn] = False
开发者ID:ReallyGnusys,项目名称:mrfbus,代码行数:32,代码来源:mrfland_weblet_devs.py


示例16: send_object_to_client

    def send_object_to_client(self,id,obj):
        if not self.clients.has_key(id):
            errstr = "asa_comm:obj to client key error, key was "+str(id)+" obj was "+str(obj)
            mrflog.error(errstr)
            return
        client = self.clients[id]

        #username = self.clients[id]['username']
        username = client['username']

        if not obj.has_key('data'):
            mrflog.error("send obj to client ... no data in %s"%repr(obj))
            return
        data = obj['data']

        if not data.has_key('tag'):
            mrflog.error("send obj to client ... no tag in %s"%repr(data))
            app = None
        else:
            app = data['tag']['app']

        mrflog.info( "send_object_to_client: sent cmd "+str(obj['cmd'])+ " to  "+username)
        msg = mrfland.to_json(obj)
        mrflog.debug(msg)
        mrflog.warn("checking client %s"%repr(client))
        if app and ((app ==  'auto_graph')  or app in client['apps']):
            client['object'].write_message(msg+"\r\n\r\n")
开发者ID:ReallyGnusys,项目名称:mrfbus,代码行数:27,代码来源:mrfland_regmanager.py


示例17: db_app_cfg_data_replace

    def db_app_cfg_data_replace(self, **kwargs):

        if not hasattr(self,'db'):
            return

        mrflog.warn("app_data_replace : kwargs %s"%repr(kwargs))
        apptag = kwargs['apptag']
        doc    = kwargs['doc']

        if kwargs.has_key('sid'):
            sid = kwargs['sid']
        else:
            sid = -1

        doc['sid'] = sid



        docdate = datetime.datetime.now()
        doc['docdate'] = docdate

        collname =  '%s.cfg.webapps'%(self.hostname)
        coll = self.db.get_collection(collname)

        filt = {'tag' : apptag }



        future = coll.replace_one(filt, doc, True)
        result = yield future

        mrflog.warn("result %s"%repr(result))
开发者ID:ReallyGnusys,项目名称:mrfbus,代码行数:32,代码来源:mrfland_regmanager.py


示例18: _resp_handler

    def _resp_handler(self,*args, **kwargs):
        rresp = os.read(self.rfd, 1024)

        mrflog.info("Input on response pipe len %d"%len(rresp))
        while len(rresp):

            hdr , param, resp  = self.parse_input(rresp)

            if hdr:
                rresp=rresp[hdr.length:]
            else:
                mrflog.warn("no hdr len(rresp) %d type resp %s"%(len(rresp),str(type(resp))))
                mrflog.warn("type hdr "+str(type(hdr)))



                #mrflog.warn("ccnt %d hdr %s parm %s resp %s"%(ccnt,repr(hdr),repr(param),repr(resp)))
            if hdr  and param  and resp :
                mrflog.info("received object %s response from  %d robj %s"%(type(param),hdr.usrc,type(resp)))
                self.handle_response(hdr, param , resp, response=True )


                mrflog.debug("_resp_handler , got resp %s"%repr(resp))
                mrflog.debug("_resp_handler , got hdr %s"%repr(hdr))
                mrflog.debug("_resp_handler , got param %s"%repr(hdr))
开发者ID:ReallyGnusys,项目名称:mrfbus,代码行数:25,代码来源:mrfland_server.py


示例19: device_register

    def device_register(self, dev):
        """ register new MrfDevice"""
        if self.devices.has_key(dev.label):
            mrflog.error("%s device_register duplicate device label %s"%dev.label)
            return
        self.devices[dev.label] = dev

        self.devmap[dev.address] = dev
        ### now enumerate device sensors
        for cap in dev.caps.keys():
            mrflog.warn("enumerating sensors type %s"%cap)
            for ch in range(len(dev.caps[cap])):
                sens = dev.caps[cap][ch]
                if self.sensors.has_key(sens.label):
                    mrflog.error("%s device_register duplicate sensor label %s"%sens.label)
                    return
                self.sensors[sens.label] = sens
                if not self.senstypes.has_key(type(sens)):
                    self.senstypes[type(sens)] = []
                self.senstypes[type(sens)].append(sens)

                if not self.senscaps.has_key(cap):
                    self.senscaps[cap] = []
                self.senscaps[cap].append(sens)

                mrflog.warn("chan %d type  %s"%(ch,type(sens)))
开发者ID:ReallyGnusys,项目名称:mrfbus,代码行数:26,代码来源:mrfland_regmanager.py


示例20: packet

    def packet(self,hdr,resp):

        if self.devmap.has_key(hdr.usrc):
            return self.devmap[hdr.usrc].packet(hdr,resp)
        else:
            mrflog.warn("got packet but no dev registered for usrc %d"%hdr.usrc)
            return None, None
开发者ID:ReallyGnusys,项目名称:mrfbus,代码行数:7,代码来源:mrfland_regmanager.py



注:本文中的mrflog.mrflog.warn函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python compat.translate_jobconf函数代码示例发布时间:2022-05-27
下一篇:
Python utils.Process类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap