Beispiel #1
0
    def __init__(self, application_id, plugin_info):
        self.logger = Log("single.controller.log", "controller.log")
        configure_logging()

        self.application_id = application_id
        self.instances = plugin_info["instances"]
        self.check_interval = plugin_info["check_interval"]
        self.trigger_down = plugin_info["trigger_down"]
        self.trigger_up = plugin_info["trigger_up"]
        self.min_cap = plugin_info["min_cap"]
        self.max_cap = plugin_info["max_cap"]
        self.actuation_size = plugin_info["actuation_size"]
        self.metric_rounding = plugin_info["metric_rounding"]
        self.actuator_type = plugin_info["actuator"]
        self.metric_source_type = plugin_info["metric_source"]

        self.running = True
        self.running_lock = threading.RLock()

        metric_source = MetricSourceBuilder().get_metric_source(
            self.metric_source_type, plugin_info)

        actuator = ActuatorBuilder().get_actuator(self.actuator_type,
                                                  plugin_info)

        self.alarm = BasicAlarm(actuator, metric_source, self.trigger_down,
                                self.trigger_up, self.min_cap, self.max_cap,
                                self.actuation_size, self.metric_rounding)
    def __init__(self, metric_source, actuator, plugin_info):
        # Set up logging
        self.logger = Log("basic.controller.log", "controller.log")
        configure_logging()

        check_interval = plugin_info["check_interval"]
        trigger_down = plugin_info["trigger_down"]
        trigger_up = plugin_info["trigger_up"]
        min_cap = plugin_info["min_cap"]
        max_cap = plugin_info["max_cap"]
        actuation_size = plugin_info["actuation_size"]
        metric_rounding = plugin_info["metric_rounding"]

        # Start alarm
        self.alarm = BasicAlarm(actuator, metric_source, trigger_down,
                                trigger_up, min_cap, max_cap, actuation_size,
                                metric_rounding)

        # Start up controller thread
        # Create lock to access application list
        self.applications_lock = threading.RLock()
        self.applications = {}
        self.controller = _BasicControllerThread(self.applications,
                                                 self.applications_lock,
                                                 self.alarm, check_interval)

        self.controller_thread = threading.Thread(target=self.controller.start)
        self.controller_thread.start()
    def __init__(self, applications, applications_lock, alarm, check_interval):
        self.logger = Log("basic.controller_thread.log", "controller.log")
        configure_logging()

        self.applications = applications
        self.applications_lock = applications_lock
        self.alarm = alarm
        self.check_interval = check_interval
        self.running = True
 def __init__(self, parameters):
     self.keypair_path = parameters['keypair_path']
     self.host_ip = parameters['host_ip']
     self.log_path = parameters['log_path']
     self.start_time = parameters['start_time']
     self.expected_time = parameters['reference_value']
     self.host_username = '******'
     self.last_checked = ''
     self.logger = Log("metrics.log", "metrics.log")
     configure_logging()
    def __init__(self, actuator, metric_source, trigger_down, trigger_up,
                 min_cap, max_cap, actuation_size, metric_rounding):

        # TODO: Check parameters
        self.metric_source = metric_source
        self.actuator = actuator
        self.trigger_down = trigger_down
        self.trigger_up = trigger_up
        self.min_cap = min_cap
        self.max_cap = max_cap
        self.actuation_size = actuation_size
        self.metric_rounding = metric_rounding

        self.logger = Log("basic.alarm.log", "controller.log")
        configure_logging()

        self.last_time_progress_timestamp = datetime.datetime.strptime(
            "0001-01-01T00:00:00.0Z", '%Y-%m-%dT%H:%M:%S.%fZ')

        self.last_job_progress_timestamp = datetime.datetime.strptime(
            "0001-01-01T00:00:00.0Z", '%Y-%m-%dT%H:%M:%S.%fZ')
    def __init__(self, application_id, plugin_info):
        self.logger = Log(
            "tendency.proportional.controller.log", "controller.log")
        configure_logging()

        plugin_info = plugin_info["plugin_info"]

        self.application_id = application_id
        self.instances = plugin_info["instances"]
        self.check_interval = plugin_info["check_interval"]
        self.trigger_down = plugin_info["trigger_down"]
        self.trigger_up = plugin_info["trigger_up"]
        self.min_cap = plugin_info["min_cap"]
        self.max_cap = plugin_info["max_cap"]
        self.metric_rounding = plugin_info["metric_rounding"]
        self.actuation_size = plugin_info["actuation_size"]
        self.actuator_type = plugin_info["actuator"]
        self.metric_source_type = plugin_info["metric_source"]

        self.running = True
        self.running_lock = threading.RLock()

        # Gets a new metric source plugin using the given name
        metric_source = MetricSourceBuilder().get_metric_source(
                            self.metric_source_type, plugin_info
                        )

        # Gets a new actuator plugin using the given name
        actuator = ActuatorBuilder().get_actuator(self.actuator_type,
                                                  plugin_info)

        """ The alarm here is responsible for deciding whether to scale up or
            down, or even do nothing """
        self.alarm = TendencyAwareProportionalAlarm(actuator, metric_source,
                                                    self.trigger_down,
                                                    self.trigger_up,
                                                    self.min_cap,
                                                    self.max_cap,
                                                    self.actuation_size,
                                                    self.metric_rounding)
Beispiel #7
0
    def __init__(self, actuator, metric_source, trigger_down, trigger_up,
                 min_cap, max_cap, actuation_size, metric_rounding):

        self.metric_source = metric_source
        self.actuator = actuator
        self.trigger_down = trigger_down
        self.trigger_up = trigger_up
        self.min_cap = min_cap
        self.max_cap = max_cap
        self.metric_rounding = metric_rounding
        self.actuation_size = actuation_size

        self.logger = Log("proportional.alarm.log", "controller.log")
        self.cap_logger = Log("cap.log", "cap.log")

        configure_logging()

        self.last_progress_error_timestamp = datetime.datetime.strptime(
            "0001-01-01T00:00:00.0Z", '%Y-%m-%dT%H:%M:%S.%fZ')
        self.last_progress_error = None
        self.cap = -1
        self.last_action = ""
Beispiel #8
0
def main():
    app = Flask(__name__)
    app.register_blueprint(rest)
    logger.configure_logging()
    logger.enable()
    app.run(host='0.0.0.0', port=api.port, debug=True)