code: def create_requests(
      specs: List[ht.JobSpec],
      project_id: str,
      credentials_path: Optional[str] = None,
  ) -> Iterable[Tuple[Any, ht.JobSpec, Any]]:
      """Returns an iterator of (HttpRequest, ht.JobSpec, Callback).
  
      HttpRequests look like:
      https://googleapis.github.io/google-api-python-client/docs/epy/googleapiclient.http.HttpRequest-class.html
  
      Iterating across the requests will trigger logging side-effects for its
      corresponding spec.
  
      Cloud API docs for the endpoint each request submits to:
      https://cloud.google.com/ml-engine/reference/rest/v1/projects.jobs/create
  
      Python specific docs:
      http://googleapis.github.io/google-api-python-client/docs/dyn/ml_v1.projects.jobs.html#create
  
      """
      parent = "projects/{}".format(project_id)
  
      # cache_discovery=False prevents an error bubbling up from a missing file
      # cache, which no user of this code is going to be using.
      ml = ml_api(credentials_path)
  
      jobs = ml.projects().jobs()
  
      for job_spec in logged_specs(specs):
          # replace the jobId field with a uid-appended id upon request creation
          spec = deepcopy(job_spec.spec)
          uid = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
          index = spec["jobId"].split("_")[-1]
          job_name = "_".join(spec["jobId"].split("_")[:-1])
          spec["jobId"] = f"{job_name}_{uid}_{index}"
          cb = job_callback(
              spec=job_spec, project_id=project_id, body=spec
          )
          yield jobs.create(body=spec, parent=parent), job_spec, cb
  
imports: from __future__ import absolute_import, division, print_function
  import datetime
  import traceback
  from copy import deepcopy
  from pprint import pformat
  from typing import Any, Dict, Iterable, List, Optional, Tuple
  import tqdm
  from absl import logging
  from blessings import Terminal
  from googleapiclient import discovery
  from googleapiclient.errors import HttpError
  import caliban.config
  import caliban.config.experiment
  import caliban.docker.build
  import caliban.docker.push
  import caliban.history.types
  import caliban.platform.cloud.types
  import caliban.platform.cloud.util
  import caliban.util
  import caliban.util.auth
  import caliban.util.metrics
  import caliban.util.tqdm
  from caliban.history.util import create_experiments, generate_container_spec, get_mem_engine, get_sql_engine, session_scope
label_desc: Use image node_id 12 for calling a global function with example usage: create_requests(specs, project_id, credentials_path) without return types