class_docstr: Lazy loading, memoizing, instantiation of SparkSessions.
  
  Useful when you want to defer SparkSession instantiation and provide access to the same
  instance throughout the application.
class_docstr_tok: ["Lazy","loading",",","memoizing",",","instantiation","of","SparkSessions",".","Useful","when","you","want","to","defer","SparkSession","instantiation","and","provide","access","to","the","same","instance","throughout","the","application","."]
docstr: Generate Spark Configurations optimized for feature_processing functionality.
  
  Args:
      is_training_job (bool): a boolean indicating whether the current execution environment
          is a training job or not.
  
  Returns:
      List[Tuple[str, str]]: Spark configurations.
docstr_tok: ["Generate","Spark","Configurations","optimized","for","feature_processing","functionality",".","Args",":","is_training_job","(","bool",")",":","a","boolean","indicating","whether","the","current","execution","environment","is","a","training","job","or","not",".","Returns",":","List","[","Tuple","[","str",",","str","]","]",":","Spark","configurations","."]
code: def _get_spark_configs(
      self, is_training_job
  ) -> List[Tuple[str, str]]:
      """Generate Spark Configurations optimized for feature_processing functionality.
  
      Args:
          is_training_job (bool): a boolean indicating whether the current execution environment
              is a training job or not.
  
      Returns:
          List[Tuple[str, str]]: Spark configurations.
      """
      spark_configs = [
          (
              "spark.hadoop.fs.s3a.aws.credentials.provider",
              ",".join(
                  [
                      "com.amazonaws.auth.ContainerCredentialsProvider",
                      "com.amazonaws.auth.profile.ProfileCredentialsProvider",
                      "com.amazonaws.auth.DefaultAWSCredentialsProviderChain",
                  ]
              ),
          ),
          # spark-3.3.1#recommended-settings-for-writing-to-object-stores - https://tinyurl.com/54rkhef6
          (
              "spark.hadoop.mapreduce.fileoutputcommitter.algorithm.version",
              "2",
          ),
          (
              "spark.hadoop.mapreduce.fileoutputcommitter.cleanup-failures.ignored",
              "true",
          ),
          ("spark.hadoop.parquet.enable.summary-metadata", "false"),
          # spark-3.3.1#parquet-io-settings https://tinyurl.com/59a7uhwu
          ("spark.sql.parquet.mergeSchema", "false"),
          ("spark.sql.parquet.filterPushdown", "true"),
          ("spark.sql.hive.metastorePartitionPruning", "true"),
          # hadoop-aws#performance - https://tinyurl.com/mutxj96f
          ("spark.hadoop.fs.s3a.threads.max", "500"),
          ("spark.hadoop.fs.s3a.connection.maximum", "500"),
          ("spark.hadoop.fs.s3a.experimental.input.fadvise", "normal"),
          ("spark.hadoop.fs.s3a.block.size", "128M"),
          ("spark.hadoop.fs.s3a.fast.upload.buffer", "disk"),
          ("spark.hadoop.fs.trash.interval", "0"),
          ("spark.port.maxRetries", "50"),
      ]
  
      if self.spark_config:
          spark_configs.extend(self.spark_config.items())
  
      if not is_training_job:
          fp_spark_jars = feature_store_pyspark.classpath_jars()
          fp_spark_packages = [
              "org.apache.hadoop:hadoop-aws:3.3.1",
              "org.apache.hadoop:hadoop-common:3.3.1",
          ]
  
          if self.spark_config and "spark.jars" in self.spark_config:
              fp_spark_jars.append(self.spark_config.get("spark.jars"))
  
          if (
              self.spark_config
              and "spark.jars.packages" in self.spark_config
          ):
              fp_spark_packages.append(
                  self.spark_config.get("spark.jars.packages")
              )
  
          spark_configs.extend(
              (
                  ("spark.jars", ",".join(fp_spark_jars)),
                  (
                      "spark.jars.packages",
                      ",".join(fp_spark_packages),
                  ),
              )
          )
  
      return spark_configs
  
file_path: sagemaker-python-sdk/src/sagemaker/feature_store/feature_processor/_spark_factory.py
imports: from __future__ import absolute_import
  from functools import lru_cache
  from typing import List, Tuple, Dict
  import feature_store_pyspark
  import feature_store_pyspark.FeatureStoreManager
  from pyspark.conf import SparkConf
  from pyspark.context import SparkContext
  from pyspark.sql import SparkSession
  from sagemaker.feature_store.feature_processor._env import EnvironmentHelper
label_desc: Use image node_id 3 for calling the SparkSessionFactory obj's underlying member method code with example usage: obj._get_spark_configs(is_training_job) and returns: spark_configs