def get_ecs_cluster_for_queue(queue_name, batch_client=None):
    'Get the name of the ecs cluster using the batch client.'
    if (batch_client is None):
        batch_client = boto3.client('batch')
    queue_resp = batch_client.describe_job_queues(jobQueues=[queue_name])
    if (len(queue_resp['jobQueues']) == 1):
        queue = queue_resp['jobQueues'][0]
    else:
        raise BatchReadingError(('Error finding queue with name %s.' % queue_name))
    compute_env_names = queue['computeEnvironmentOrder']
    if (len(compute_env_names) == 1):
        compute_env_name = compute_env_names[0]['computeEnvironment']
    else:
        raise BatchReadingError(('Error finding the compute environment name for %s.' % queue_name))
    compute_envs = batch_client.describe_compute_environments(computeEnvironments=[compute_env_name])['computeEnvironments']
    if (len(compute_envs) == 1):
        compute_env = compute_envs[0]
    else:
        raise BatchReadingError(('Error getting compute environment %s for %s. Got %d enviornments instead of 1.' % (compute_env_name, queue_name, len(compute_envs))))
    ecs_cluster_name = os.path.basename(compute_env['ecsClusterArn'])
    return ecs_cluster_name
Get the name of the ecs cluster using the batch client.
def get_ecs_cluster_for_queue(queue_name, batch_client=None):
    
    if (batch_client is None):
        batch_client = boto3.client('batch')
    queue_resp = batch_client.describe_job_queues(jobQueues=[queue_name])
    if (len(queue_resp['jobQueues']) == 1):
        queue = queue_resp['jobQueues'][0]
    else:
        raise BatchReadingError(('Error finding queue with name %s.' % queue_name))
    compute_env_names = queue['computeEnvironmentOrder']
    if (len(compute_env_names) == 1):
        compute_env_name = compute_env_names[0]['computeEnvironment']
    else:
        raise BatchReadingError(('Error finding the compute environment name for %s.' % queue_name))
    compute_envs = batch_client.describe_compute_environments(computeEnvironments=[compute_env_name])['computeEnvironments']
    if (len(compute_envs) == 1):
        compute_env = compute_envs[0]
    else:
        raise BatchReadingError(('Error getting compute environment %s for %s. Got %d enviornments instead of 1.' % (compute_env_name, queue_name, len(compute_envs))))
    ecs_cluster_name = os.path.basename(compute_env['ecsClusterArn'])
    return ecs_cluster_name