def get_checks(): checks = {} conf_d_directory = get_confd_path(get_os()) for filename in sorted(os.listdir(conf_d_directory)): module_name, ext = osp.splitext(filename) if filename.split('.')[0] in EXCLUDED_WINDOWS_CHECKS: continue if ext not in ('.yaml', '.example', '.disabled'): continue agent_check = AgentCheck(filename, ext, conf_d_directory) if (agent_check.enabled or agent_check.module_name not in checks or (not agent_check.is_example and not checks[agent_check.module_name].enabled)): checks[agent_check.module_name] = agent_check checks_list = checks.values() checks_list.sort(key=lambda c: c.module_name) return checks_list
def initialize(self): if get_os().startswith('Windows'): sumoBinary = checkBinary('sumo.exe') else: sumoBinary = checkBinary('sumo') sumoCommandLine = [sumoBinary, "-c", self.ConfigFile, "-l", "sumo.log"] self.SumoProcess = subprocess.Popen(sumoCommandLine, stdout=sys.stdout, stderr=sys.stderr) traci.init(self.Port) self.SimulationBoundary = traci.simulation.getNetBoundary() self.XBase = self.SimulationBoundary[0][0] self.XSize = self.SimulationBoundary[1][0] - self.XBase self.YBase = self.SimulationBoundary[0][1] self.YSize = self.SimulationBoundary[1][1] - self.YBase #self.__Logger.warn("starting sumo connector") # initialize the edge list, drop all the internal edges self.EdgeList = [] for edge in traci.edge.getIDList(): # this is just to ensure that everything is initialized first time traci.edge.adaptTraveltime(edge, traci.edge.getTraveltime(edge)) # only keep the "real" edges for computation for now if not edge.startswith(':'): self.EdgeList.append(edge) self.CurrentEdgeList = list(self.EdgeList) # initialize the traffic light state tllist = traci.trafficlights.getIDList() for tl in tllist: self.TrafficLights[ tl] = traci.trafficlights.getRedYellowGreenState(tl) traci.trafficlights.subscribe(tl, [tc.TL_RED_YELLOW_GREEN_STATE]) # initialize the induction loops illist = traci.inductionloop.getIDList() for il in illist: traci.inductionloop.subscribe(il, [tc.LAST_STEP_VEHICLE_NUMBER])
@author Mic Bowman @date 2013-12-03 This is the main script for the netbuilder tool. It reads and executes a network configuration program building the output configuration files for the specified connectors (opensim, sumo or social) """ import os, sys import logging, logging.handlers, warnings from common.util import get_os sys.path.insert( 0, os.path.realpath(os.path.join(os.path.dirname(__file__), "../.."))) if get_os().startswith('Windows'): if os.environ.get("SUMO_WINDOWS"): sys.path.append(os.path.join(os.environ.get("SUMO_WINDOWS"), "tools")) else: print "set environment variable SUMO_WINDOWS to the SUMO directory" sys.exit(1) else: if os.environ.get("SUMO_LINUX"): sys.path.append(os.path.join(os.environ.get("SUMO_LINUX"), "tools")) else: print "set environment variable SUMO_LINUX to the SUMO directory" sys.exit(1) from applications.mobdat.builder import Controller import time, argparse, json