code: def __init__(self, config, driver: CloudDriver, logger=None):
      self.logger = logger or get_logger("auto_scaler")
      # Should be after we create logger
      self.state = State.STARTING
  
      self.driver = driver
      self.logger.info("using %s driver", self.driver.kind())
      self.driver.set_scaler(self)
  
      self.resource_configurations = config.resource_configurations
      self.queues = config.queues  # queue name -> list of resources
      self.resource_to_queue = {
          item[0]: queue
          for queue, resources in self.queues.items()
          for item in resources
      }
  
      if not self.sanity_check():
          raise ValueError("health check failed")
  
      self.max_idle_time_min = float(config.max_idle_time_min)
      self.polling_interval_time_min = float(
          config.polling_interval_time_min
      )
      self.max_spin_up_time_min = float(config.max_spin_up_time_min)
  
      # make sure we have our own unique prefix, in case we have multiple dynamic auto-scalers
      # they will mix each others instances
      self.workers_prefix = config.workers_prefix
  
      session = Session()
      self.set_auth(session)
  
      # Set up the environment variables for clearml
      defs.ENV_HOST.set(session.get_api_server_host())
      defs.ENV_WEB_HOST.set(session.get_app_server_host())
      defs.ENV_FILES_HOST.set(session.get_files_server_host())
      defs.ENV_ACCESS_KEY.set(session.access_key)
      defs.ENV_SECRET_KEY.set(session.secret_key)
      if self.auth_token:
          defs.ENV_AUTH_TOKEN.set(self.auth_token)
  
      self.api_client = APIClient()
      self._stop_event = Event()
      self.state = State.READY
  
imports: import re
  from collections import defaultdict, deque
  from enum import Enum
  from itertools import chain
  from threading import Event, Thread
  from time import sleep, time
  import attr
  from attr.validators import instance_of
  from .cloud_driver import CloudDriver
  from ..None import Task
  from ..backend_api import Session
  from ..backend_api.session import defs
  from ..backend_api.session.client import APIClient
  from ..debugging import get_logger
label_desc: Use image node_id 1 to create a new AutoScaler object from inherited base classes: object with example: obj = AutoScaler(config, driver, logger)