def runFillResources(force): conf=hltdconf.hltdConf('/etc/hltd.conf') #NOTE:will not work with daq3val, role must be set if conf.role==None and (os.uname()[1].startswith('fu-') or os.uname()[1].startswith('dvrubu-')): role='fu' else: role = conf.role if role=='fu' and not conf.dqm_machine: #no action on FU if using dynamic resource setting (default) if not conf.dynamic_resources or force: clearDir(conf.resource_base+'/idle') clearDir(conf.resource_base+'/online') clearDir(conf.resource_base+'/except') clearDir(conf.resource_base+'/quarantined') #if any resources found in cloud, machine assumed to be running cloud foundInCloud=len(os.listdir(conf.resource_base+'/cloud'))>0 clearDir(conf.resource_base+'/cloud') def fillCores(): global resource_count with open('/proc/cpuinfo','r') as fp: for line in fp: if line.startswith('processor'): #by default do not touch cloud settings,unless force if foundInCloud and not force: open(conf.resource_base+'/cloud/core'+str(resource_count),'a').close() else: open(conf.resource_base+'/quarantined/core'+str(resource_count),'a').close() resource_count+=1 fillCores() #fill with more cores for VM environment if os.uname()[1].startswith('fu-vm-'): fillCores() fillCores() fillCores()
logging.basicConfig(filename="/tmp/elastic.log", level=logging.INFO, format='%(levelname)s:%(asctime)s-%(name)s.%(funcName)s - %(message)s', datefmt='%Y-%m-%d %H:%M:%S') logger = logging.getLogger(os.path.basename(__file__)) #STDOUT AND ERR REDIRECTIONS #sys.stderr = stdErrorLog() #sys.stdout = stdOutLog() #signal.signal(signal.SIGINT, signalHandler) eventQueue = Queue.Queue() conf=hltdconf.hltdConf('/etc/hltd.conf') dirname = sys.argv[1] dirname = os.path.basename(os.path.normpath(dirname)) watchDir = os.path.join(conf.watch_directory,dirname) outputDir = conf.micromerge_output mask = pyinotify.IN_CLOSE_WRITE logger.info("starting elastic for "+dirname) try: #starting inotify thread wm = pyinotify.WatchManager() mr = MonitorRanger() mr.setEventQueue(eventQueue) notifier = pyinotify.ThreadedNotifier(wm, mr)
def __init__(self): Daemon2.__init__(self,'soap2file','main','hltd') #SOAPpy.Config.debug = 1 self._conf=hltdconf.hltdConf('/etc/hltd.conf') self._hostname = os.uname()[1]
logging.basicConfig( filename="/tmp/elastic.log", level=logging.INFO, format='%(levelname)s:%(asctime)s-%(name)s.%(funcName)s - %(message)s', datefmt='%Y-%m-%d %H:%M:%S') logger = logging.getLogger(os.path.basename(__file__)) #STDOUT AND ERR REDIRECTIONS #sys.stderr = stdErrorLog() #sys.stdout = stdOutLog() #signal.signal(signal.SIGINT, signalHandler) eventQueue = Queue.Queue() conf = hltdconf.hltdConf('/etc/hltd.conf') dirname = sys.argv[1] dirname = os.path.basename(os.path.normpath(dirname)) watchDir = os.path.join(conf.watch_directory, dirname) #outputDir = conf.micromerge_output mask = pyinotify.IN_CLOSE_WRITE logger.info("starting elastic for " + dirname) try: #starting inotify thread wm = pyinotify.WatchManager() mr = MonitorRanger() mr.setEventQueue(eventQueue) notifier = pyinotify.ThreadedNotifier(wm, mr) notifier.start() wdd = wm.add_watch(watchDir, mask, rec=False, auto_add=True)