Commit c435b79f authored by Thomas Phil's avatar Thomas Phil

RM-55 scheduler optimizations

parent 6167a877
......@@ -26,7 +26,7 @@ class SurfHpcScaler(AbstractScaleIn, AbstractScaleOut, AbstractVmTemplateRetriev
return deadline
def get_templates(self):
return self._config.schedulerdomain.surfhpcscaler.templates.as_dict()
return self._config.templates.as_dict()
def scalein(self, command):
if strongr.core.gateways.Gateways.lock('scaleout-lock').exists():
......@@ -89,7 +89,7 @@ class SurfHpcScaler(AbstractScaleIn, AbstractScaleOut, AbstractVmTemplateRetriev
query_factory = strongr.core.domain.schedulerdomain.SchedulerDomain.queryFactory()
query_bus = strongr.core.domain.schedulerdomain.SchedulerDomain.schedulerService().getQueryBus()
templates = dict(config.schedulerdomain.simplescaler.templates.as_dict()) # make a copy because we want to manipulate the list
templates = dict(config.templates.as_dict()) # make a copy because we want to manipulate the list
active_vms = query_bus.handle(query_factory.newRequestVms([VmState.NEW, VmState.PROVISION, VmState.READY]))
......@@ -104,12 +104,6 @@ class SurfHpcScaler(AbstractScaleIn, AbstractScaleOut, AbstractVmTemplateRetriev
# don't provision more than 2 VM's at the same time
return
if cores <= 0 or cores < config.schedulerdomain.surfhpcscaler.scaleoutmincoresneeded:
return
if ram <= 0 or ram < config.schedulerdomain.surfhpcscaler.scaleoutminramneeded:
return
for template in templates:
templates[template]['distance'] = templates[template]['ram'] / templates[template]['cores']
......@@ -134,8 +128,7 @@ class SurfHpcScaler(AbstractScaleIn, AbstractScaleOut, AbstractVmTemplateRetriev
# scaleout by one instance
cloudService = strongr.core.domain.clouddomain.CloudDomain.cloudService()
cloudCommandFactory = strongr.core.domain.clouddomain.CloudDomain.commandFactory()
cloudProviderName = config.clouddomain.driver
profile = getattr(config.clouddomain, cloudProviderName).default_profile if 'profile' not in templates[template] else templates[template]['profile']
profile = config.default_profile if 'profile' not in templates[template] else templates[template]['profile']
deployVmsCommand = cloudCommandFactory.newDeployVms(names=[template + '-' + str(uuid.uuid4())], profile=profile, cores=templates[template]['cores'], ram=templates[template]['ram'])
cloudCommandBus = cloudService.getCommandBus()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment