import logging


def get_valid_eval_tasks(tasks, split):
    """Get tasks that have the specified split and a metric function."""

    valid_tasks = []

    for task in tasks:
        if split not in task.splits:
            logging.info("Task %s has no '%s' split; skipping eval.",
                         task.name, split)
            continue
        if not task.metric_fns:
            logging.info("Task %s has no metric_fns; skipping eval.",
                         task.name)
            continue
        valid_tasks.append(task)

    return valid_tasks