def METHOD_NAME(kfp_dirs):
    meta_dir, artifacts_dir, output_dir = kfp_dirs
    p1 = [1, 2, 3]
    task = _generate_task(p1, output_dir)
    task.with_hyper_params({"p1": p1}, selector="min.loss")
    best_iteration = 1  # loss is 3 * p1, so min loss will be when p1=1
    expected_accuracy = 2 * p1[best_iteration - 1]
    expected_loss = 3 * p1[best_iteration - 1]
    result = new_function(kfp=True).run(task, handler=my_job)
    _assert_meta_dir(meta_dir, expected_accuracy, expected_loss, best_iteration)
    _assert_artifacts_dir(artifacts_dir, expected_accuracy, expected_loss)
    _assert_output_dir(output_dir, result.metadata.name, iterations=len(p1))
    assert result.output("accuracy") == expected_accuracy
    assert result.output("loss") == expected_loss
    assert result.status.state == "completed"