def get_subset_tasks(all_tasks, ratio):
    """Select a subset of tasks from all_tasks, keeping some % from each temp.
    Args:
        all_tasks: List of tasks like ['00001:001', ...]
        ratio: A number between 0-1, specifying how many of the tasks to keep.
    Returns:
        tasks: An updated list, with the ratio number of tasks.
    """
    if len(all_tasks) == 0:
        return all_tasks
    assert 0.0 <= ratio <= 1.0
    all_tasks = sorted(all_tasks)
    samples_to_keep = int(len(all_tasks) * ratio)
    return all_tasks[::(len(all_tasks) // samples_to_keep)][:samples_to_keep]