code: def init_spark_standalone(
      self,
      num_executors,
      executor_cores,
      executor_memory="2g",
      driver_cores=4,
      driver_memory="1g",
      master=None,
      extra_executor_memory_for_ray=None,
      extra_python_lib=None,
      conf=None,
      jars=None,
      python_location=None,
      enable_numa_binding=False,
  ):
      import subprocess
      import pyspark
      from zoo.util.utils import get_node_ip
  
      if "PYSPARK_PYTHON" not in os.environ:
          os.environ["PYSPARK_PYTHON"] = (
              python_location
              if python_location
              else detect_python_location()
          )
      if not master:
          pyspark_home = os.path.abspath(pyspark.__file__ + "/../")
          zoo_standalone_home = os.path.abspath(
              __file__ + "/../../share/bin/standalone"
          )
          node_ip = get_node_ip()
          SparkRunner.standalone_env = {
              "SPARK_HOME": pyspark_home,
              "ZOO_STANDALONE_HOME": zoo_standalone_home,
              # If not set this, by default master is hostname but not ip,
              "SPARK_MASTER_HOST": node_ip,
          }
          if "JAVA_HOME" in os.environ:
              SparkRunner.standalone_env["JAVA_HOME"] = os.environ[
                  "JAVA_HOME"
              ]
          # The scripts installed from pip don't have execution permission
          # and need to first give them permission.
          pro = subprocess.Popen(
              [
                  "chmod",
                  "-R",
                  "+x",
                  "{}/sbin".format(zoo_standalone_home),
              ]
          )
          os.waitpid(pro.pid, 0)
          # Start master
          start_master_pro = subprocess.Popen(
              "{}/sbin/start-master.sh".format(zoo_standalone_home),
              shell=True,
              env=SparkRunner.standalone_env,
          )
          _, status = os.waitpid(start_master_pro.pid, 0)
          if status != 0:
              raise RuntimeError("starting master failed")
          master = "spark://{}:7077".format(
              node_ip
          )  # 7077 is the default port
          # Start worker
          if enable_numa_binding:
              worker_script = "start-worker-with-numactl.sh"
              SparkRunner.standalone_env[
                  "SPARK_WORKER_INSTANCES"
              ] = str(num_executors)
          else:
              worker_script = "start-worker.sh"
          start_worker_pro = subprocess.Popen(
              "{}/sbin/{} {}".format(
                  zoo_standalone_home, worker_script, master
              ),
              shell=True,
              env=SparkRunner.standalone_env,
          )
          _, status = os.waitpid(start_worker_pro.pid, 0)
          if status != 0:
              raise RuntimeError("starting worker failed")
      else:  # A Spark standalone cluster has already been started by the user.
          assert master.startswith("spark://"), (
              "Please input a valid master address for your Spark standalone cluster: "
              "spark://master:port"
          )
  
      # Start pyspark-shell
      submit_args = "--master " + master
      submit_args = submit_args + gen_submit_args(
          driver_cores,
          driver_memory,
          num_executors,
          executor_cores,
          executor_memory,
          extra_python_lib,
          jars,
      )
  
      conf = enrich_conf_for_spark(
          conf,
          driver_cores,
          driver_memory,
          num_executors,
          executor_cores,
          executor_memory,
          extra_executor_memory_for_ray,
      )
      conf.update(
          {
              "spark.cores.max": num_executors * executor_cores,
              "spark.executorEnv.PYTHONHOME": "/".join(
                  detect_python_location().split("/")[:-2]
              ),
          }
      )
      zoo_bigdl_jar_path = ":".join(
          list(get_zoo_bigdl_classpath_on_driver())
      )
      if "spark.executor.extraClassPath" in conf:
          conf["spark.executor.extraClassPath"] = "{}:{}".format(
              zoo_bigdl_jar_path, conf["spark.executor.extraClassPath"]
          )
      else:
          conf["spark.executor.extraClassPath"] = zoo_bigdl_jar_path
  
      sc = self.create_sc(submit_args, conf)
      return sc
  
file_path: analytics-zoo/pyzoo/zoo/util/spark.py
imports: import os
  import platform
  from pyspark import SparkContext
  from zoo import init_nncontext, init_spark_conf
  from zoo.util.utils import detect_python_location, pack_penv
  from zoo.util.utils import get_executor_conda_zoo_classpath, get_zoo_bigdl_classpath_on_driver
label_desc: Use image node_id 5 for calling the SparkRunner obj's underlying member method code with example usage: obj.init_spark_standalone(num_executors, executor_cores, executor_memory, driver_cores, driver_memory, master, extra_executor_memory_for_ray, extra_python_lib, conf, jars, python_location, enable_numa_binding) and returns: sc