code: def get_results_from_build(
      bk: Buildkite, build: Build, results_to_fetch: Dict
  ) -> Dict:
      fetched_results = {}
  
      for job_dict in build.job_dict_list:
          if not results_to_fetch:
              break
  
          job = Job(
              build=build,
              id=job_dict["id"],
              name=job_dict.get("name", None),
          )
  
          if not job.name:
              continue
  
          for job_regex, filename in list(results_to_fetch.items()):
              if re.match(job_regex, job.name):
                  result = get_results_artifact_for_job(bk, job=job)
  
                  if not result:
                      continue
  
                  fetched_results[filename] = result
                  results_to_fetch.pop(job_regex)
                  print(
                      f"Fetched {filename} for commit {job.build.commit}"
                  )
  
      return fetched_results
  
file_path: ray/release/release_logs/fetch_release_logs.py
imports: import json
  import os
  import re
  from dataclasses import dataclass
  from pathlib import Path
  from typing import Any, Dict, List, Optional
  import boto3
  import click
  from pybuildkite.buildkite import Buildkite
label_desc: Use image node_id 4 for calling a global function with example usage: get_results_from_build(bk, build, results_to_fetch) and returns: fetched_results