code: def ensure_immutable_elastic_config(
      runtime_elastic_config_dict: dict,
  ):
      """
      Ensure the resource scheduler saw the same elastic config we are using at runtime
      """
      if DEEPSPEED_ELASTICITY_CONFIG in os.environ:
          scheduler_elastic_config_dict = json.loads(
              os.environ[DEEPSPEED_ELASTICITY_CONFIG]
          )
          scheduler_elastic_config = ElasticityConfig(
              scheduler_elastic_config_dict
          )
          runtime_elastic_config = ElasticityConfig(
              runtime_elastic_config_dict
          )
          err_str = "Elastic config '{}={}' seen by resource scheduler does not match config passed to runtime {}={}"
          if (
              runtime_elastic_config.max_acceptable_batch_size
              != scheduler_elastic_config.max_acceptable_batch_size
          ):
              raise ElasticityConfigError(
                  err_str.format(
                      "max_acceptable_batch_size",
                      scheduler_elastic_config.max_acceptable_batch_size,
                      "max_acceptable_batch_size",
                      runtime_elastic_config.max_acceptable_batch_size,
                  )
              )
          if (
              runtime_elastic_config.micro_batches
              != scheduler_elastic_config.micro_batches
          ):
              raise ElasticityConfigError(
                  err_str.format(
                      "micro_batches",
                      scheduler_elastic_config.micro_batches,
                      "micro_batches",
                      runtime_elastic_config.micro_batches,
                  )
              )
          if (
              runtime_elastic_config.version
              != scheduler_elastic_config.version
          ):
              raise ElasticityConfigError(
                  err_str.format(
                      "version",
                      scheduler_elastic_config.version,
                      "version",
                      runtime_elastic_config.version,
                  )
              )
      else:
          logger.warning(
              "Unable to find DEEPSPEED_ELASTICITY_CONFIG environment variable, cannot "
              "guarantee resource scheduler will scale this job using compatible GPU counts."
          )
  
file_path: DeepSpeed/deepspeed/elasticity/elasticity.py
imports: import os
  import json
  import numpy
  import math
  from packaging import version
  from .config import ElasticityConfig, ElasticityConfigError, ElasticityError, ElasticityIncompatibleWorldSize
  from .constants import ELASTICITY, ENABLED, ENABLED_DEFAULT, LATEST_ELASTICITY_VERSION, MINIMUM_DEEPSPEED_VERSION, DEEPSPEED_ELASTICITY_CONFIG
  from ..git_version_info import version
  from ..utils import logger
label_desc: Use image node_id 8 for calling a global function with example usage: ensure_immutable_elastic_config(runtime_elastic_config_dict) without return types