Esempio n. 1
0
    def get_cluster(self, cloud_provider=None, config=None, nodes=None):
        if not cloud_provider:
            cloud_provider = BotoCloudProvider("https://hobbes.gc3.uzh.ch/",
                                               "nova", "a-key", "s-key")
        if not config:
            config = Configuration().get_config(self.path)

        setup = Mock()
        configurator = Configurator(config)
        conf_login = configurator.cluster_conf['mycluster']['login']
        repository = PickleRepository(self.storage_path)

        cluster = Cluster(
            name="mycluster",
            cloud_provider=cloud_provider,
            setup_provider=setup,
            repository=repository,
            user_key_name=conf_login['user_key_name'],
            user_key_public=conf_login['user_key_public'],
            user_key_private=conf_login['user_key_private'],
        )

        if not nodes:
            nodes = {"compute": 2, "frontend": 1}

        for kind, num in nodes.iteritems():
            conf_kind = configurator.cluster_conf['mycluster']['nodes'][kind]
            cluster.add_nodes(kind, num, conf_kind['image_id'],
                              conf_login['image_user'], conf_kind['flavor'],
                              conf_kind['security_group'])

        return cluster
Esempio n. 2
0
 def create_repository(self):
     storage_path = self.general_conf['storage']
     repository = PickleRepository(storage_path)
     return repository
Esempio n. 3
0
 def setUp(self):
     self.path = tempfile.mkdtemp()
     self.storage = PickleRepository(self.path)