code: def _create_job_spec_dict(
      experiment: Experiment,
      job_mode: c.JobMode,
      image_id: str,
      index: int,
      caliban_config: Dict[str, Any],
      run_args: Optional[List[str]] = None,
  ) -> Dict[str, Any]:
      """creates a job spec dictionary for a local job"""
  
      # Without the unbuffered environment variable, stderr and stdout won't be
      # emitted in the proper order from inside the container.
      terminal_cmds = [
          "-e",
          "PYTHONUNBUFFERED=1",
      ] + window_size_env_cmds()
  
      base_cmd = (
          _run_cmd(job_mode, run_args) + terminal_cmds + [image_id]
      )
  
      launcher_args = um.mlflow_args(
          caliban_config=caliban_config,
          experiment_name=experiment.xgroup.name,
          index=index,
          tags={
              um.GPU_ENABLED_TAG: str(
                  job_mode == c.JobMode.GPU
              ).lower(),
              um.TPU_ENABLED_TAG: "false",
              um.DOCKER_IMAGE_TAG: image_id,
              um.PLATFORM_TAG: Platform.LOCAL.value,
          },
      )
  
      cmd_args = ce.experiment_to_args(
          experiment.kwargs, experiment.args
      )
  
      # cmd args *must* be last in order for the launcher to pass them through
      command = base_cmd + launcher_args + cmd_args
  
      return {"command": command, "container": image_id}
  
imports: from __future__ import absolute_import, division, print_function
  from datetime import datetime
  import json
  import os
  import subprocess
  import sys
  import traceback
  from typing import Any, Dict, Iterable, List, Optional
  import tqdm
  from absl import logging
  from blessings import Terminal
  from tqdm.utils import _screen_shape_wrapper
  import caliban.config
  import caliban.config.experiment
  import caliban.docker.build
  import caliban.util
  import caliban.util.fs
  import caliban.util.metrics
  import caliban.util.tqdm
  from caliban.history.types import Experiment, Job, JobSpec, JobStatus, Platform
  from caliban.history.util import create_experiments, generate_container_spec, get_mem_engine, get_sql_engine, session_scope
label_desc: Use image node_id 7 for calling a global function with example usage: _create_job_spec_dict(experiment, job_mode, image_id, index, caliban_config, run_args) and returns: dict