def METHOD_NAME(self, request) -> str:
    match = re.match(r"^/jobs/(job-\d+)(/|$)", request.path)
    if not match:
        raise ValueError(f"Failed to extract job_id from {request.path}")
    job_id = match.group(1)
    assert job_id in self.batch_jobs
    return job_id