def create(data): # TODO: We need to create an request-check/validation filter before inserting cluster_details = data hadoopstack.main.mongo.db.cluster.insert(cluster_details) id_t = str(cluster_details['_id']) data['cluster']['id'] = id_t flush_data_to_mongo('cluster', data) create_ret = {} create_ret['cid'] = id_t Process(target = _create_cluster, args = (data, cluster_details['_id'])).start() return create_ret
def create(data): # TODO: We need to create an request-check/validation filter before inserting cluster_details = data hadoopstack.main.mongo.db.cluster.insert(cluster_details) id_t = str(cluster_details['_id']) data['cluster']['id'] = id_t flush_data_to_mongo('cluster', data) create_ret = {} create_ret['cid'] = id_t Process(target=_create_cluster, args=(data, cluster_details['_id'])).start() return create_ret
def spawn(data): data['cluster']['status'] = 'spawning' flush_data_to_mongo('cluster', data) cluster_name = data['cluster']['name'] keypair_name = "hadoopstack-" + cluster_name sec_slave = "hadoopstack-" + cluster_name + "-slave" sec_master = "hadoopstack-" + cluster_name + "-master" conn = make_connection() create_keypair(conn, keypair_name) create_security_groups(conn, cluster_name) data['cluster']['nodes'] = [] master = data['cluster']['master'] res_master = boot_instances( conn, 1, keypair_name, [sec_master], flavor = master['flavor'] ) data['cluster']['nodes'] += get_node_objects(conn, "master", res_master.id) flush_data_to_mongo('cluster', data) associate_public_ip(conn, res_master.instances[0].id) for slave in data['cluster']['slaves']: res_slave = boot_instances( conn, slave['instances'], keypair_name, [sec_slave], flavor = slave['flavor'] ) data['cluster']['nodes'] += get_node_objects(conn, "slave", res_slave.id) flush_data_to_mongo('cluster', data) update_private_ip_address(conn, data) return
def spawn(data): data['cluster']['status'] = 'spawning' flush_data_to_mongo('cluster', data) cluster_name = data['cluster']['name'] keypair_name = "hadoopstack-" + cluster_name sec_slave = "hadoopstack-" + cluster_name + "-slave" sec_master = "hadoopstack-" + cluster_name + "-master" conn = make_connection() create_keypair(conn, keypair_name) create_security_groups(conn, cluster_name) data['cluster']['nodes'] = [] master = data['cluster']['master'] res_master = boot_instances(conn, 1, keypair_name, [sec_master], flavor=master['flavor']) data['cluster']['nodes'] += get_node_objects(conn, "master", res_master.id) flush_data_to_mongo('cluster', data) associate_public_ip(conn, res_master.instances[0].id) for slave in data['cluster']['slaves']: res_slave = boot_instances(conn, slave['instances'], keypair_name, [sec_slave], flavor=slave['flavor']) data['cluster']['nodes'] += get_node_objects(conn, "slave", res_slave.id) flush_data_to_mongo('cluster', data) update_private_ip_address(conn, data) return