from typing import Tuple
from typing import Mapping
from typing import Sequence
from typing import Any


def metrics_fn_for_time(task_group: Tuple[int, Mapping[str, str]],
                        values: Sequence[Mapping[str, Any]],
                        tasks: Sequence[Any]) -> Mapping[str, float]:
  """Extract wallclock times for each task."""
  del task_group
  times = [r["total_time"] for r in values]
  to_write = {}
  for t, task_time in zip(tasks, times):
    unused_cfg, name = t.task_content
    to_write[f"{name}/time"] = task_time

  return {k: float(v) for k, v in to_write.items()}