code: def __init__(
      self,
      app,
      db: Database,  # BORROWED
      inst_coll_manager: InstanceCollectionManager,
      resource_manager: CloudResourceManager,
      machine_name_prefix: str,
      config: PoolConfig,
      async_worker_pool: AsyncWorkerPool,  # BORROWED
      task_manager: aiotools.BackgroundTaskManager,  # BORROWED
  ):
      super().__init__(
          db,
          inst_coll_manager,
          resource_manager,
          config.cloud,
          config.name,
          machine_name_prefix,
          is_pool=True,
          max_instances=config.max_instances,
          max_live_instances=config.max_live_instances,
          task_manager=task_manager,
      )
      self.app = app
      self.inst_coll_manager = inst_coll_manager
      global_scheduler_state_changed: Notice = self.app[
          "scheduler_state_changed"
      ]
      self.scheduler_state_changed = (
          global_scheduler_state_changed.subscribe()
      )
      self.scheduler = PoolScheduler(
          self.app, self, async_worker_pool, task_manager
      )
  
      self.healthy_instances_by_free_cores = sortedcontainers.SortedSet(
          key=lambda instance: instance.free_cores_mcpu
      )
  
      self.worker_type = config.worker_type
      self.worker_cores = config.worker_cores
      self.worker_local_ssd_data_disk = (
          config.worker_local_ssd_data_disk
      )
      self.worker_external_ssd_data_disk_size_gb = (
          config.worker_external_ssd_data_disk_size_gb
      )
      self.standing_worker_cores = config.standing_worker_cores
      self.boot_disk_size_gb = config.boot_disk_size_gb
      self.data_disk_size_gb = config.data_disk_size_gb
      self.data_disk_size_standing_gb = (
          config.data_disk_size_standing_gb
      )
      self.preemptible = config.preemptible
      self.max_new_instances_per_autoscaler_loop = (
          config.max_new_instances_per_autoscaler_loop
      )
      self.autoscaler_loop_period_secs = (
          config.autoscaler_loop_period_secs
      )
      self.standing_worker_max_idle_time_secs = (
          config.standing_worker_max_idle_time_secs
      )
      self.worker_max_idle_time_secs = config.worker_max_idle_time_secs
      self.job_queue_scheduling_window_secs = (
          config.job_queue_scheduling_window_secs
      )
      self.min_instances = config.min_instances
  
      self.all_supported_regions = self.inst_coll_manager.regions
  
imports: import asyncio
  import logging
  import random
  from collections import defaultdict
  from typing import Dict, List, Optional, Tuple
  import prometheus_client
  import sortedcontainers
  from gear import Database
  from hailtop import aiotools
  from hailtop.utils import AsyncWorkerPool, Notice, WaitableSharedPool, periodically_call_with_dynamic_sleep, retry_long_running, run_if_changed, secret_alnum_string, time_msecs
  from ...batch_format_version import BatchFormatVersion
  from ...globals import INSTANCE_VERSION
  from ...inst_coll_config import PoolConfig
  from ...utils import ExceededSharesCounter, regions_bits_rep_to_regions
  from ..instance import Instance
  from ..job import mark_job_errored, schedule_job
  from ..resource_manager import CloudResourceManager
  from .base import InstanceCollection, InstanceCollectionManager
label_desc: Use image node_id 1 to create a new Pool object from inherited base classes: InstanceCollection with example: obj = Pool(app, db, inst_coll_manager, resource_manager, machine_name_prefix, config, async_worker_pool, task_manager)