code: def spin_up_workers(
      runner_args, config, resources_needed, queue_name, verbose=10
  ):
      cloud = runner_args.cloud
      if cloud:
          assert cloud in ["gcloud", "gcspot", "ec2", "ec2spot"]
          worker_manager = model.get_worker_manager(
              config, cloud, verbose=verbose
          )
  
          if cloud == "gcloud" or cloud == "ec2":
              if runner_args.num_workers:
                  num_workers = int(runner_args.num_workers)
              else:
                  num_workers = 1
  
              for i in range(num_workers):
                  worker_manager.start_worker(
                      queue_name,
                      resources_needed,
                      ssh_keypair=runner_args.ssh_keypair,
                      timeout=runner_args.cloud_timeout,
                      ports=runner_args.port,
                  )
          else:
              assert runner_args.bid is not None
              if runner_args.num_workers:
                  start_workers = runner_args.num_workers
                  queue_upscaling = False
              else:
                  start_workers = 1
                  queue_upscaling = True
  
              worker_manager.start_spot_workers(
                  queue_name,
                  runner_args.bid,
                  resources_needed,
                  start_workers=start_workers,
                  queue_upscaling=queue_upscaling,
                  ssh_keypair=runner_args.ssh_keypair,
                  timeout=runner_args.cloud_timeout,
                  ports=runner_args.port,
              )
  
      elif queue_name == "local":
          worker_args = ["studio-local-worker"]
  
          if runner_args.config:
              worker_args += ["--config=" + runner_args.config]
  
          if runner_args.guest:
              worker_args += ["--guest"]
  
          # logger.info('worker args: {}'.format(worker_args))
          if (
              not runner_args.num_workers
              or int(runner_args.num_workers) == 1
          ):
              if "STUDIOML_DUMMY_MODE" not in os.environ:
                  retval = local_worker.main(worker_args)
                  sys.exit(retval)
          else:
              raise NotImplementedError(
                  "Multiple local workers are not " + "implemented yet"
              )
  
imports: import copy
  import sys
  import argparse
  import re
  import os
  import uuid
  import importlib
  import time
  import six
  import numpy
  from studio.credentials.credentials import KEY_CREDENTIALS
  from studio.hyperparameter import HyperparameterParser
  from studio.extra_util import Progbar, rsync_cp
  from studio.experiments.experiment import create_experiment
  from studio.experiment_submitter import submit_experiments
  from studio import model
  from studio import git_util
  from studio import local_worker
  from studio import fs_tracker
  from studio.dependencies_policies.studio_dependencies_policy import StudioDependencyPolicy
  from studio.util import logs, util
label_desc: Use image node_id 2 for calling a global function with example usage: spin_up_workers(runner_args, config, resources_needed, queue_name, verbose) without return types