Changeset 1507


Ignore:
Timestamp:
Feb 18, 2014 12:09:54 PM (10 years ago)
Author:
jemian
Message:

trim up the API a bit

File:
1 edited

Legend:

Unmodified
Added
Removed
  • topdoc/trunk/src/bcda/ask_alive.py

    r1506 r1507  
    33'''ask_alive: get BCDA IOC information
    44
    5 On the APS internal network, query the BCDA alive support
     5On the APS internal network, query the BCDA alive record service
    66for recent information about the status of known IOCs.
     7
     8EXAMPLE::
     9
     10  from bcda.ask_alive import identify_iocs
     11  known_ioc_dict = identify_iocs()      # get a dictionary of known IOCs from "alive"
     12  for name in known_ioc_dict.keys():
     13      print name, known_ioc_dict[name].alive
     14
    715'''
    816
     
    2230                self.name = ''
    2331                self.address = ''
    24                 self.timer = ''
     32                self.timer = 0
    2533                self.uptime = ''
    2634                self.downtime = ''
     35                self.alive = False
    2736                self.env = dict(ARCH='', TOP='', EPICS_BASE='',
    2837                                                SUPPORT='', LOCATION='', ENGINEER='')
     
    4352                                self.env[key] = value
    4453
     54                self.alive = self.timer < TIMER_THRESHOLD_DEAD_IOC
     55
    4556        def subnode_text(self, node, subnode_tag):
    4657                '''return the text from the named subnode'''
     
    5667        '''read all the IOCs from the XML document, return as {name:Ioc()}'''
    5768        doc = etree.parse(xml_source)
    58         version = doc.getroot().get('version', UNVERSIONED_XML)
     69        root = doc.getroot()
     70        version = root.get('version', UNVERSIONED_XML)
    5971        if version not in (UNVERSIONED_XML):
    6072                raise RuntimeError, 'unexpected version: ' + version
     
    7991                c += 1
    8092                row = [c, k, ioc.address,]
    81                 if ioc.timer < TIMER_THRESHOLD_DEAD_IOC:
     93                if ioc.alive:
    8294                        row.append(ioc.uptime)
    8395                else:
Note: See TracChangeset for help on using the changeset viewer.