Пример #1
0
 def wait_until_cluster_is_ready(self, cluster_id: str):    # NOT IMPLEMENTED
     try:
         util.wait_for_master_to_be_ready(self.cluster._core_cluster_operations, self.cluster, cluster_id)
         pool = self.batch_client.pool.get(cluster_id)
         nodes = self.batch_client.compute_node.list(pool_id=cluster_id)
         return models.Cluster(base_models.Cluster(pool, nodes))
     except batch_error.BatchErrorException as e:
         raise error.AztkError(helpers.format_batch_exception(e))
Пример #2
0
def get_pool_details(core_cluster_operations, cluster_id: str):
    """
        Print the information for the given cluster
        :param cluster_id: Id of the cluster
        :return pool: CloudPool, nodes: ComputeNodePaged
    """
    pool = core_cluster_operations.batch_client.pool.get(cluster_id)
    nodes = core_cluster_operations.batch_client.compute_node.list(pool_id=cluster_id)
    return models.Cluster(pool, nodes)
Пример #3
0
    def __get_pool_details(self, cluster_id: str):
        """
            Print the information for the given cluster
            :param cluster_id: Id of the cluster
            :return pool: CloudPool, nodes: ComputeNodePaged
        """
        pool = self.batch_client.pool.get(cluster_id)
        if pool.state is batch_models.PoolState.deleting:
            return models.Cluster(pool)

        nodes = self.batch_client.compute_node.list(pool_id=cluster_id)
        return pool, nodes
Пример #4
0
def list_clusters(cluster_client, software_metadata_key):
    """
        List all the cluster on your account.
    """
    pools = cluster_client.batch_client.pool.list()
    software_metadata = (constants.AZTK_SOFTWARE_METADATA_KEY,
                         software_metadata_key)
    cluster_metadata = (constants.AZTK_MODE_METADATA_KEY,
                        constants.AZTK_CLUSTER_MODE_METADATA)

    aztk_clusters = []
    for pool in [pool for pool in pools if pool.metadata]:
        pool_metadata = [(metadata.name, metadata.value)
                         for metadata in pool.metadata]
        if all([
                metadata in pool_metadata
                for metadata in [software_metadata, cluster_metadata]
        ]):
            aztk_clusters.append(models.Cluster(pool))
    return aztk_clusters