def _create_container()

in python-batch/gke_batch/batch.py [0:0]


  def _create_container(self):

    # Get container settings
    container_settings = get_setting("container", settings)
    image = get_setting("image_uri", container_settings)

    # Get Job commands
    command = get_setting("command", settings)

    env1 = kubernetes.client.V1EnvVar(
      name = "JOB_NAME",
      value_from=kubernetes.client.V1EnvVarSource(
        field_ref=kubernetes.client.V1ObjectFieldSelector(
          field_path="metadata.name"
        )
      )
    )

    # Get Job Limits
    limits = get_setting("limits", settings)

    # Create container
    
    container = kubernetes.client.V1Container(
      name=self.job_prefix,
      image=image,
      command=command,
      resources=kubernetes.client.V1ResourceRequirements(
          limits=limits,
      ),
      env = [env1],
    )
    return(container)