code: def train(
      job_id,
      resume_job_id,
      bucket_name,
      region,
      config_files,
      dataset,
      scale_tier,
      master_type,
      worker_type,
      worker_count,
      parameter_server_type,
      parameter_server_count,
  ):
      account = ServiceAccount()
      account.validate_region(region)
  
      if bucket_name is None:
          bucket_name = "luminoth-{}".format(account.client_id)
          click.echo(
              'Bucket name not specified. Using "{}".'.format(
                  bucket_name
              )
          )
  
      # Creates bucket for logs and models if it doesn't exist
      bucket = account.get_bucket(bucket_name)
  
      if not job_id:
          job_id = "train_{}".format(
              datetime.now().strftime("%Y%m%d_%H%M%S")
          )
  
      # Path in bucket to store job's config, logs, etc.
      # If we are resuming a previous job, then we will use the same path
      # that job used, so Luminoth will load the checkpoint from there.
      base_path = "lumi_{}".format(
          resume_job_id if resume_job_id else job_id
      )
  
      package_path = build_package(bucket, base_path)
      job_dir = "gs://{}/{}".format(bucket_name, base_path)
  
      override_params = [
          "train.job_dir={}".format(job_dir),
      ]
  
      if dataset:
          # Check if absolute or relative dataset path
          if not dataset.startswith("gs://"):
              dataset = "gs://{}".format(dataset)
          override_params.append("dataset.dir={}".format(dataset))
  
      # Even if we are resuming job, we will use a new config. Thus, we will
      # overwrite the config in the old job's dir if it existed.
      config = get_config(config_files, override_params=override_params)
  
      # Update final config file to job bucket
      config_path = "{}/{}".format(base_path, DEFAULT_CONFIG_FILENAME)
      upload_data(bucket, config_path, dump_config(config))
  
      args = [
          "--config",
          "{}/{}".format(job_dir, DEFAULT_CONFIG_FILENAME),
      ]
  
      cloudml = account.cloud_service("ml")
  
      training_inputs = {
          "scaleTier": scale_tier,
          "packageUris": [
              "gs://{}/{}".format(bucket_name, package_path)
          ],
          "pythonModule": "luminoth.train",
          "args": args,
          "region": region,
          "jobDir": job_dir,
          "runtimeVersion": RUNTIME_VERSION,
          "pythonVersion": PYTHON_VERSION,
      }
  
      if scale_tier == "CUSTOM":
          training_inputs["masterType"] = master_type
          if worker_count > 0:
              training_inputs["workerCount"] = worker_count
              training_inputs["workerType"] = worker_type
  
          if parameter_server_count > 0:
              training_inputs[
                  "parameterServerCount"
              ] = parameter_server_count
              training_inputs[
                  "parameterServerType"
              ] = parameter_server_type
  
      job_spec = {"jobId": job_id, "trainingInput": training_inputs}
  
      jobrequest = (
          cloudml.projects()
          .jobs()
          .create(
              body=job_spec,
              parent="projects/{}".format(account.project_id),
          )
      )
  
      try:
          click.echo("Submitting training job.")
          res = jobrequest.execute()
          click.echo("Job submitted successfully.")
          click.echo(
              "state = {}, createTime = {}".format(
                  res.get("state"), res.get("createTime")
              )
          )
          if resume_job_id:
              click.echo(
                  "\nNote: this job is resuming job {}.\n".format(
                      resume_job_id
                  )
              )
          click.echo("Job id: {}".format(job_id))
          click.echo("Job directory: {}".format(job_dir))
  
          save_run(config, environment="gcloud", extra_config=job_spec)
  
      except Exception as err:
          click.echo(
              "There was an error creating the training job. "
              "Check the details: \n{}".format(err._get_reason())
          )
  
imports: import click
  import json
  import luminoth
  import os
  import shutil
  import subprocess
  import sys
  import tempfile
  import tensorflow
  import time
  from datetime import datetime
  from functools import wraps
  from luminoth.utils.config import get_config, dump_config
  from luminoth.utils.experiments import save_run
label_desc: Use image node_id 6 for calling a global function with example usage: train(job_id, resume_job_id, bucket_name, region, config_files, dataset, scale_tier, master_type, worker_type, worker_count, parameter_server_type, parameter_server_count) without return types