code: def __init__(
      self,
      # Name of experiment
      experimentId,
      # Completion service configuration
      cs_config=None,
      # used to pass a studioML configuration block read by client software
      studio_config=None,
      # Studio config yaml file
      studio_config_file=None,
      shutdown_del_queue=False,
  ):
      # StudioML configuration
      self.config = model.get_config(studio_config_file)
  
      self.logger = logs.get_logger(self.__class__.__name__)
      self.verbose_level = parse_verbosity(self.config["verbose"])
      self.logger.setLevel(self.verbose_level)
  
      # Setup Completion Service instance properties
      # based on configuration
      self.experimentId = experimentId
      self.project_name = "completion_service_" + experimentId
  
      self.resumable = RESUMABLE
      self.clean_queue = CLEAN_QUEUE
      self.queue_upscaling = QUEUE_UPSCALING
      self.num_workers = int(cs_config.get("num_workers", 1))
      self.cloud_timeout = cs_config.get("timeout")
      self.bid = cs_config.get("bid")
      self.ssh_keypair = cs_config.get("ssh_keypair")
      self.sleep_time = cs_config.get("sleep_time")
      self.shutdown_del_queue = shutdown_del_queue
  
      # Figure out request for resources:
      resources_needed = cs_config.get("resources_needed")
      self.resources_needed = DEFAULT_RESOURCES_NEEDED
      self.resources_needed.update(resources_needed)
      studio_resources = self.config.get("resources_needed")
      if studio_resources:
          self.resources_needed.update(studio_resources)
  
      # Figure out task queue and cloud we are going to use:
      queue_name = cs_config.get("queue")
      cloud_name = cs_config.get("cloud")
      if cs_config.get("local"):
          queue_name = None
          cloud_name = None
      elif queue_name is not None:
          self.shutdown_del_queue = False
          if cloud_name in ["ec2spot", "ec2"]:
              assert queue_name.startswith("sqs_")
      else:
          queue_name = self.experiment_id
          if cloud_name in ["ec2spot", "ec2"]:
              queue_name = "sqs_" + queue_name
      self.cloud = cloud_name
      if queue_name is not None and queue_name.startswith("rmq_"):
          assert self.cloud is None
  
      self.wm = model.get_worker_manager(self.config, self.cloud)
  
      if queue_name is not None:
          self.logger.info(
              "CompletionService configured with queue {0}".format(
                  queue_name
              )
          )
  
      self.queue = model.get_queue(
          queue_name=queue_name,
          cloud=self.cloud,
          config=self.config,
          logger=self.logger,
          verbose=self.verbose_level,
      )
  
      self.queue_name = self.queue.get_name()
  
      self.submitted = {}
      self.use_spot = cloud_name in ["ec2spot", "gcspot"]
  
      self.logger.info("Project name: {0}".format(self.project_name))
      self.logger.info(
          "Initial/final queue name: {0}, {1}".format(
              queue_name, self.queue_name
          )
      )
      self.logger.info("Cloud name: {0}".format(self.cloud))
  
imports: import os
  import subprocess
  import uuid
  import pickle
  import tempfile
  import re
  import six
  import time
  from studio import experiment_submitter, model, fs_tracker, logs
  from studio.util import rsync_cp, parse_verbosity
  from studio.experiment import create_experiment
label_desc: Use image node_id 1 to create a new CompletionService object  with example: obj = CompletionService(experimentId, cs_config, studio_config, studio_config_file, shutdown_del_queue)