Changeset 10040 in genesis


Ignore:
Timestamp:
Mar 6, 2012, 1:51:47 PM (13 years ago)
Author:
rick
Message:

Use gformat of yaml parsing instead of using right paths.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/get-link-traffic.py

    r10035 r10040  
    66# Rick van der Zwet <info@rickvanderzwet.nl>
    77#
     8import gformat
    89import glob
    910import logging
     
    6566  ff = ''
    6667
    67 def process_file(logger, m_snmp, m_traffic, m_uptime, nf, rescan):
    68   data = yaml.load(open(nf,'r'))
     68def process_file(logger, m_snmp, m_traffic, m_uptime, host, rescan):
     69  data = gformat.get_yaml(host)
    6970  nodename = data['nodename']
    7071
     
    113114  logger = logging.getLogger('Worker%s' % i)
    114115  logger.info("Worker")
    115   for (nf, rescan) in iter(input.get, 'STOP'):
    116     process_file(logger, m_snmp, m_traffic, m_uptime, nf, rescan)
     116  for (host, rescan) in iter(input.get, 'STOP'):
     117    process_file(logger, m_snmp, m_traffic, m_uptime, host, rescan)
    117118  logger.info("END")
    118119
     
    140141    plist[i].start()
    141142
    142   for nf in sorted(glob.glob('nodes/*%s*/wleiden.yaml' % ff)):
    143     task_queue.put((nf, RESCAN))
     143  for host in sorted(gformat.get_hostlist()):
     144    if ff and not ff in host:
     145      continue
     146    task_queue.put((host, RESCAN))
    144147
    145148  for i in range(NUMBER_OF_PROCESSES):
Note: See TracChangeset for help on using the changeset viewer.