예제 #1
0
    def add_util_forecast(self, util_forecast):
        """
		Attaches utilization forecast, checks to make sure length is consistent.
		"""
        serieslen = fetch_yaml('leptoid/model_config.yml')['horizon']

        if serieslen != len(util_forecast):
            raise Exception(
                "Utilization forecast does not have correct length.")
        else:
            self.util_forecast = util_forecast
예제 #2
0
	def add_util_forecast(self, util_forecast):
		"""
		Attaches utilization forecast, checks to make sure length is consistent.
		"""
		serieslen = fetch_yaml('leptoid/model_config.yml')['horizon']

		if serieslen != len(util_forecast):
			raise Exception(
					"Utilization forecast does not have correct length.")
		else:
			self.util_forecast = util_forecast
예제 #3
0
	def __init__(self, metric_targets,
			scaling_config='leptoid/scaling_config.yml'):
		"""
		Reads configs from local YAML file. Posibility of consolidating these.
		"""
		# Scaling limits.
		config = utils.fetch_yaml(scaling_config)
		self.api_params = config['render_config']
		self.upscale_limits = config['upscale_limits']
		self.downscale_limits = config['downscale_limits']
		self.upscale_time_horizon = config['upscale_time_horizon']
		self.downscale_time_horizon = config['downscale_time_horizon']

		# Target namespaces
		self.targets = metric_targets 
		LOG.debug("Targets:")
		LOG.debug(self.targets)

		self.recent_deploys = dict()
		self.rollback_limit = {'production': 3600, 'staging': 600}

		# Configs for forecasting
		self.model_config = config['model_config']
예제 #4
0
파일: deploy.py 프로젝트: acompa/leptoid
    'm1': {
        '2xlarge': 'xlarge',
        'xlarge': 'large',
        'large': 'medium',
        'medium': 'small'
    },
    'm2': {
        '4xlarge': '2xlarge',
        '2xlarge': 'xlarge'
    },
    'c1': {
        'xlarge': 'medium'
    }
}

NOOP_MODE = fetch_yaml('leptoid/scaling_config.yml')['noop']


def upscale(queue):
    """ Externally-facing method for upscaling a service's instance size.

	Parameters
	----------
	queue
		leptoid.ServiceQueue object with the environment, service type, and
		instance id to be scaled

	Returns: int specifying deployment id#
	"""

    # Return blank deployment id in case of an error.
예제 #5
0
파일: deploy.py 프로젝트: acompa/leptoid
			'xlarge': '2xlarge', '2xlarge': '4xlarge'},
		'c1': {
			'medium': 'xlarge'}
		}

DOWNSCALE_TARGETS = {
		'm1': {
			'2xlarge': 'xlarge', 'xlarge': 'large', 'large': 'medium',
			'medium': 'small'},
		'm2': {
			'4xlarge': '2xlarge', '2xlarge': 'xlarge'},
		'c1': {
			'xlarge': 'medium'}
		}

NOOP_MODE = fetch_yaml('leptoid/scaling_config.yml')['noop']

def upscale(queue):
	""" Externally-facing method for upscaling a service's instance size.

	Parameters
	----------
	queue
		leptoid.ServiceQueue object with the environment, service type, and
		instance id to be scaled

	Returns: int specifying deployment id#
	"""

	# Return blank deployment id in case of an error.
	deploy_id = 0