job_id = "clock", task_id = next_tick()) ) sleep( (float(_5) ** 2 ) * .01 ) except Exception as e: connector.log.exception(e) raise Exception("AARG %r" % e) connector = Connector("cpu") carbon_send = carbon_maker(connector) def cpu(connector, payload, vector): cpu_f.seek(0) _5,_10,_15 = cpu_f.read().split(" ")[:3] # cpu_clock(connector,_5 , vector) reroute_to(connector, frequency, vector) if int(vector["task_id"]) % 100 == 0: carbon_send( { "5m" : float(_5), "10m" : float(_10), "15m" : float(_15) }) return { "data" : [ _5,_10,_15], "load" : _5, "5min" : _5, "10min" : _10, "15min" : _15 } connector.func = cpu connector.turbine()
import sys from os import path, getpid from dsat.state import state_wrapper, construct_info from dsat.carbon import carbon_maker from archery.bow import Hankyu as dict import psutil from time import time, sleep CFG, L_CFG, ID = construct_info(sys.argv, "proc") send = carbon_maker(**CFG) def proc(cnx, arg): res= dict() sum_file = dict() procc= dict() sum_connection = dict() percent_mem= dict() all_proc = psutil.get_process_list() carbon_measure = dict() interesting = { '/usr/lib/firefox/firefox', '/opt/google/chrome/chrome', 'mysqld', 'mongod', "ping.py", "proc.py", "master.py", "tracker.py","cpu.py", "rrd.py", "csvw.py"} for x in all_proc: try: key = ( set(x.cmdline()) & interesting) and "me" or "other" carbon_key=None cmd = x.cmdline()
import sys from os import path, getpid from dsat.state import Connector from dsat.carbon import carbon_maker from archery.bow import Hankyu as dict import psutil from psutil import NoSuchProcess from time import time, sleep connect_me = Connector("proc") send = carbon_maker(connect_me,**connect_me.local_info) def proc(ctx, payload, msg): res= dict() sum_file = dict() procc= dict() sum_connection = dict() percent_mem= dict() all_proc = psutil.get_process_list() carbon_measure = dict() interesting = { '/usr/lib/firefox/firefox', '/opt/google/chrome/chrome', 'mysqld', 'mongod', "ping.py", "clock.py", "orchester.py", "proc.py", "master.py", "tracker.py","cpu.py", "rrd.py", "csvw.py"}
#time_keeper = scheduler(time, sleep) if not len(sys.argv) >= 1: raise( Exception("Arg")) CONFIG, LOCAL_INFO, ID = construct_info(sys.argv, "orchester") dictConfig(CONFIG.get("logging",{})) CONFIG.update(LOCAL_INFO) class Dummy(object): pass emulate_connector = Dummy emulate_connector.config = CONFIG emulate_connector.local_info = LOCAL_INFO carbon_send = carbon_maker(emulate_connector) log = logging.getLogger("orchester") D = log.debug D("Started %(step)s" % LOCAL_INFO) CNX = get_connection(CONFIG, LOCAL_INFO) def event_listener(CNX, config): """Processlet responsible for routing and reacting on status change""" D("event listener") cnx = CNX poller = zmq.Poller() out_sign = cnx["_context"].socket(zmq.PUB)