Ejemplo n.º 1
0
    def __init__(self, config, name):
        # Guard the data with a semaphore to ensure consistency.
        self.data_sem = threading.Semaphore()
        self.properties = {}
        self.statistics = deque()
        self.variables = {}
        self.name = name
        self.fields = None
        self.optional_fields = None
        self.collectors = []
        self.logger = logging.getLogger('mom.Monitor')

        plot_dir = config.get('__int__', 'plot-subdir')
        if plot_dir != '':
            self.plotter = Plotter(plot_dir, name)
        else:
            self.plotter = None

        graphite_host = config.get('main', 'graphite-host')
        graphite_port = config.get('main', 'graphite-port')
        graphite_protocol = config.get('main', 'graphite-protocol')

        if graphite_host != '':
            self.graphite = Graphite(graphite_host, int(graphite_port),
                                     graphite_protocol, name)
        else:
            self.graphite = None

        self.ready = None
        self._terminate = False
Ejemplo n.º 2
0
 def set_policy(self, total_mem, plot_dir):
     self.total_mem_ratio = total_mem
     name = 'Policy'
     if plot_dir != '':
         self.plotter = Plotter(plot_dir, name)
         self.plotter.setFields(self.fields)
     else:
         self.plotter = None
Ejemplo n.º 3
0
 def set_policy(self, type, total_mem, plot_dir, alpha, beta):
     self.type = type
     self.total_mem_ratio = total_mem
     self.alpha = alpha
     self.beta = beta
     name = 'Policy'
     if plot_dir != '':
         self.plotter = Plotter(plot_dir, name)
         self.plotter.setFields(self.fields.union(self.fit_fields))
     else:
         self.plotter = None
Ejemplo n.º 4
0
    def __init__(self, config, name):
        # Guard the data with a lock to ensure consistency.
        self.data_lock = threading.Lock()
        self.properties = {}
        self.statistics = deque()
        self.variables = {}
        self.name = name
        self.fields = None
        self.optional_fields = None
        self.collectors = []
        self.logger = logging.getLogger('mom.Monitor')

        plot_dir = config.get('__int__', 'plot-subdir')
        if plot_dir != '':
            self.plotter = Plotter(plot_dir, name)
        else:
            self.plotter = None

        self.ready = None
        self._terminate = False