博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
spark-shell到sparkcontext的过程
阅读量:4215 次
发布时间:2019-05-26

本文共 1750 字,大约阅读时间需要 5 分钟。

在bin/spark-shell 中会调用spark-submitfunction main() {  if $cygwin; then    # Workaround for issue involving JLine and Cygwin    # (see http://sourceforge.net/p/jline/bugs/40/).    # If you're using the Mintty terminal emulator in Cygwin, may need to set the    # "Backspace sends ^H" setting in "Keys" section of the Mintty options    # (see https://github.com/sbt/sbt/issues/562).    stty -icanon min 1 -echo > /dev/null 2>&1    export SPARK_SUBMIT_OPTS="$SPARK_SUBMIT_OPTS -Djline.terminal=unix"    "${SPARK_HOME}"/bin/spark-submit --class org.apache.spark.repl.Main --name "Spark shell" "$@"    stty icanon echo > /dev/null 2>&1  else    export SPARK_SUBMIT_OPTS    "${SPARK_HOME}"/bin/spark-submit --class org.apache.spark.repl.Main --name "Spark shell" "$@"  fi}"bin/spark-submit" 中会继续调用spark-class,并制定执行类org.apache.spark.deploy.SparkSubmitif [ -z "${SPARK_HOME}" ]; then  source "$(dirname "$0")"/find-spark-homefi# disable randomized hash for string in Python 3.3+export PYTHONHASHSEED=0exec "${SPARK_HOME}"/bin/spark-class org.apache.spark.deploy.SparkSubmit "$@"在bin/spark-class中首先找到runner,这里看到是调用java# Find the java binaryif [ -n "${JAVA_HOME}" ]; then  RUNNER="${JAVA_HOME}/bin/java"else  if [ "$(command -v java)" ]; then    RUNNER="java"  else    echo "JAVA_HOME is not set" >&2    exit 1  fifi可以看到是调用java 运行org.apache.spark.launcher.Main 这个类build_command() {  "$RUNNER" -Xmx128m -cp "$LAUNCH_CLASSPATH" org.apache.spark.launcher.Main "$@"  printf "%d\0" $?}下面将build_command 中的保存到CMDset +o posixCMD=()while IFS= read -d '' -r ARG; do  CMD+=("$ARG")done < <(build_command "$@")最后执行javaCMD=("${CMD[@]:0:$LAST}")exec "${CMD[@]}"最终在launcher.Main 中调用sparksubmit->repl->sparkloop.process->initializespark->createsparkcontext 至此最重要的sparkcontext登场了

 

转载地址:http://qinmi.baihongyu.com/

你可能感兴趣的文章
test
查看>>
关于拷贝构造函数
查看>>
深拷贝与浅拷贝
查看>>
VC++中的Win32 Application和Win32 Console Application区别(转)
查看>>
Linux 下Sqlite3 的安装及应用
查看>>
(转贴)Linux如何设置自启动程序
查看>>
使用workbench进行在线调试
查看>>
3D Touch (github下载源码)
查看>>
ios开发之倒计时实现的方法
查看>>
ios 支付宝支付 (github下载源码)
查看>>
一个UITableViewCell简单动画效果
查看>>
iOS IPv6 最新升级攻略
查看>>
ios获取手机型号、系统版本、设备唯一标识符、手机运营商等
查看>>
ios获取当前时间和日期
查看>>
常用正则表达式大全
查看>>
仿QQ左边侧滑+手势 (github下载源码)
查看>>
ios 跳转系统设置位置、通知等
查看>>
ios App启动加载广告页面思路
查看>>
ios 添加日历提醒事件
查看>>
ios 计算文字高度
查看>>