Exemplo n.º 1
0
class GalaxyPackage(Package):
    cm_instance = CloudManInstance("http://127.0.0.1:42284",
                                   get_cluster_password())

    def is_installed(self):
        try:
            cluster_info = self.cm_instance.get_cluster_type()
            if cluster_info and cluster_info['cluster_type'] == "Galaxy":
                return True
        except Exception:
            pass
        return False

    def is_installing(self):
        try:
            if self.cm_instance.get_cluster_type(
            ) and self.cm_instance.get_galaxy_state() in ("Unstarted",
                                                          "Starting"):
                return True
        except Exception:
            pass
        return False

    def install(self):
        return self.cm_instance.initialize("Galaxy",
                                           galaxy_data_option="transient")
Exemplo n.º 2
0
def start_cloudman(name, pwd, cm_type, inst_type, ami, ak, sk):
    """
    Start an instance of CloudMan with the provided arguments.

    Returns a tuple: an instance of ``CloudManConfig`` pointing to the
    settings used to launch this instance of CloudMan; and an instance
    of ``CloudManInstance`` pointing to the given instance of CloudMan.
    """
    cloud = None  # If left as None, BioBlend will default to Amazon
    # Define properties for the NeCTAR cloud
    cloud = Bunch(id='-1',
                  name="NeCTAR",
                  cloud_type='openstack',
                  bucket_default='cloudman-os',
                  region_name='melbourne',
                  region_endpoint='nova.rc.nectar.org.au',
                  ec2_port=8773,
                  ec2_conn_path='/services/Cloud',
                  cidr_range='115.146.92.0/22',
                  is_secure=True,
                  s3_host='swift.rc.nectar.org.au',
                  s3_port=8888,
                  s3_conn_path='/')
    # Create an instance of the CloudManConfig class and launch a CloudMan instance
    cmc = CloudManConfig(
        ak, sk, name, ami, inst_type, pwd, cloud_metadata=cloud,
        cloudman_type=cm_type, initial_storage_size=2, placement='melbourne-np')
    print("Configured an instance; waiting to launch and boot...")
    cmi = CloudManInstance.launch_instance(cmc)
    print("Done! CloudMan IP is {0}".format(cmi.cloudman_url))
    return cmc, cmi
Exemplo n.º 3
0
def launch_gvl(access_key, secret_key, image_id, zone,
               instance_type, cluster_name, password, user_data_file):
    user_data = {}
    with open(user_data_file) as f:
        for key, value in yaml.load(f).iteritems():
            user_data[key] = value

    cloud_metadata = Bunch(id='1',  # for compatibility w/ DB representation
                           name="NeCTAR",
                           cloud_type="openstack",
                           bucket_default="cloudman-gvl-400",
                           region_name="melbourne",
                           region_endpoint="nova.rc.nectar.org.au",
                           ec2_port=8773,
                           ec2_conn_path="/services/Cloud",
                           cidr_range="115.146.92.0/22",
                           is_secure=True,
                           s3_host="swift.rc.nectar.org.au",
                           s3_port=8888,
                           s3_conn_path='/')

    cfg = CloudManConfig(access_key=access_key, secret_key=secret_key,
                         cluster_name=cluster_name, image_id=image_id,
                         instance_type=instance_type, password=password,
                         cloud_metadata=cloud_metadata, placement=zone,
                         **user_data)
    return CloudManInstance.launch_instance(cfg)
Exemplo n.º 4
0
 def setUpClass(cls):
     super(TestCloudmanServices, cls).setUpClass()
     cls.cfg = CloudManConfig(cls.access_key,
                              cls.secret_key,
                              cls.cluster_name,
                              cls.ami_id,
                              cls.instance_type,
                              cls.password,
                              cloud_metadata=cls.cloud_metadata)
     cls.cmi = CloudManInstance.launch_instance(cls.cfg)
Exemplo n.º 5
0
class CloudmanService():
    cm_instance = CloudManInstance("http://127.0.0.1:42284",
                                   get_cluster_password())

    def terminate(self):
        self.cm_instance.terminate(terminate_master_instance=True,
                                   delete_cluster=True)

    def reboot(self):
        return None
Exemplo n.º 6
0
 def test_launch_and_terminate(self):
     cls = TestCloudmanLaunch
     cfg = CloudManConfig(cls.access_key, cls.secret_key, cls.cluster_name, cls.ami_id, cls.instance_type, cls.password, cloud_metadata=cls.cloud_metadata)
     cmi = CloudManInstance.launch_instance(cfg)
     status = cmi.get_status()
     self.assertNotEqual(status['cluster_status'], 'ERROR', "instance.get_status() returned ERROR. Should return a successful status!")
     with contextlib.suppress(Exception):
         # TODO: The terminate method is unpredictable! Needs fix.
         result = cmi.terminate(delete_cluster=True)
         self.assertEqual(result['cluster_status'], 'SHUTDOWN', "Cluster should be in status SHUTDOWN after call to terminate!")
Exemplo n.º 7
0
 def test_launch_and_terminate(self):
     cls = TestCloudmanLaunch
     cfg = CloudManConfig(cls.access_key, cls.secret_key, cls.cluster_name, cls.ami_id, cls.instance_type, cls.password, cloud_metadata=cls.cloud_metadata)
     cmi = CloudManInstance.launch_instance(cfg)
     status = cmi.get_status()
     self.assertNotEqual(status['cluster_status'], 'ERROR', "instance.get_status() returned ERROR. Should return a successful status!")
     try:
         # TODO: The terminate method is unpredictable! Needs fix.
         result = cmi.terminate(delete_cluster=True)
         self.assertEqual(result['cluster_status'], 'SHUTDOWN', "Cluster should be in status SHUTDOWN after call to terminate!")
     except:
         pass
Exemplo n.º 8
0
 def setUpClass(cls):
     super(TestCloudmanServices, cls).setUpClass()
     cls.cfg = CloudManConfig(
         cls.access_key,
         cls.secret_key,
         cls.cluster_name,
         cls.ami_id,
         cls.instance_type,
         cls.password,
         cloud_metadata=cls.cloud_metadata,
     )
     cls.cmi = CloudManInstance.launch_instance(cls.cfg)
Exemplo n.º 9
0
def start_cloudman(name, pwd, cm_type, inst_type, ami, ak, sk):
    """
    Start an instance of CloudMan with the provided arguments.

    Returns a tuple: an instance of ``CloudManConfig`` pointing to the
    settings used to launch this instance of CloudMan; and an instance
    of ``CloudManInstance`` pointing to the given instance of CloudMan.
    """
    cloud = None  # If left as None, BioBlend will default to Amazon
    # Define properties for the NeCTAR cloud
    cloud = Bunch(id='-1',
                  name="NeCTAR",
                  cloud_type='openstack',
                  bucket_default='cloudman-os',
                  region_name='melbourne',
                  region_endpoint='nova.rc.nectar.org.au',
                  ec2_port=8773,
                  ec2_conn_path='/services/Cloud',
                  cidr_range='115.146.92.0/22',
                  is_secure=True,
                  s3_host='swift.rc.nectar.org.au',
                  s3_port=8888,
                  s3_conn_path='/')
    # Create an instance of the CloudManConfig class and launch a CloudMan instance
    cmc = CloudManConfig(ak,
                         sk,
                         name,
                         ami,
                         inst_type,
                         pwd,
                         cloud_metadata=cloud,
                         cloudman_type=cm_type,
                         initial_storage_size=2,
                         placement='melbourne-np')
    print("Configured an instance; waiting to launch and boot...")
    cmi = CloudManInstance.launch_instance(cmc)
    print("Done! CloudMan IP is {0}".format(cmi.cloudman_url))
    return cmc, cmi