- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我期待在通过 Yarn 提交任何失败的情况下自动重启 Spark 作业的配置或参数。我知道任务会在失败时自动重启。我非常期待能够触发重新运行整个作业的YARN 或 Spark 配置。
现在,如果我们的任何作业由于任何问题而中止,我们必须手动重新启动它,这会导致需要处理很长的数据队列,因为这些作业旨在近乎实时地工作。
当前配置:
#!/bin/bash
export SPARK_MAJOR_VERSION=2
# Minimum TODOs on a per job basis:
# 1. define name, application jar path, main class, queue and log4j-yarn.properties path
# 2. remove properties not applicable to your Spark version (Spark 1.x vs. Spark 2.x)
# 3. tweak num_executors, executor_memory (+ overhead), and backpressure settings
# the two most important settings:
num_executors=6
executor_memory=32g
# 3-5 cores per executor is a good default balancing HDFS client throughput vs. JVM overhead
# see http://blog.cloudera.com/blog/2015/03/how-to-tune-your-apache-spark-jobs-part-2/
executor_cores=2
# backpressure
reciever_minRate=1
receiver_max_rate=10
receiver_initial_rate=10
/usr/hdp/2.6.1.0-129/spark2/bin/spark-submit --master yarn --deploy-mode cluster \
--name br1_warid_ccn_sms_production \
--class com.spark.main\
--driver-memory 16g \
--num-executors ${num_executors} --executor-cores ${executor_cores} --executor-memory ${executor_memory} \
--queue default \
--files log4j-yarn-warid-br1-ccn-sms.properties \
--conf "spark.driver.extraJavaOptions=-Dlog4j.configuration=log4j-yarn-warid-br1-ccn-sms.properties" \
--conf "spark.executor.extraJavaOptions=-Dlog4j.configuration=log4j-yarn-warid-br1-ccn-sms.properties" \
--conf spark.serializer=org.apache.spark.serializer.KryoSerializer `# Kryo Serializer is much faster than the default Java Serializer` \
--conf spark.kryoserializer.buffer.max=1g \
--conf spark.locality.wait=30 \
--conf spark.task.maxFailures=8 `# Increase max task failures before failing job (Default: 4)` \
--conf spark.ui.killEnabled=true `# Prevent killing of stages and corresponding jobs from the Spark UI` \
--conf spark.logConf=true `# Log Spark Configuration in driver log for troubleshooting` \
`# SPARK STREAMING CONFIGURATION` \
--conf spark.scheduler.mode=FAIR \
--conf spark.default.parallelism=32 \
--conf spark.streaming.blockInterval=200 `# [Optional] Tweak to balance data processing parallelism vs. task scheduling overhead (Default: 200ms)` \
--conf spark.streaming.receiver.writeAheadLog.enable=true `# Prevent data loss on driver recovery` \
--conf spark.streaming.backpressure.enabled=false \
--conf spark.streaming.kafka.maxRatePerPartition=${receiver_max_rate} `# [Spark 1.x]: Corresponding max rate setting for Direct Kafka Streaming (Default: not set)` \
`# YARN CONFIGURATION` \
--conf spark.yarn.driver.memoryOverhead=4096 `# [Optional] Set if --driver-memory < 5GB` \
--conf spark.yarn.executor.memoryOverhead=4096 `# [Optional] Set if --executor-memory < 10GB` \
--conf spark.yarn.maxAppAttempts=4 `# Increase max application master attempts (needs to be <= yarn.resourcemanager.am.max-attempts in YARN, which defaults to 2) (Default: yarn.resourcemanager.am.max-attempts)` \
--conf spark.yarn.am.attemptFailuresValidityInterval=1h `# Attempt counter considers only the last hour (Default: (none))` \
--conf spark.yarn.max.executor.failures=$((8 * ${num_executors})) `# Increase max executor failures (Default: max(numExecutors * 2, 3))` \
--conf spark.yarn.executor.failuresValidityInterval=1h `# Executor failure counter considers only the last hour` \
--conf spark.task.maxFailures=8 \
--conf spark.speculation=false \
/home//runscripts/production.jar
注意:主题领域有几个问题,但没有公认的答案,或者答案与预期的解决方案不同。 Running a Spark application on YARN, without spark-submit How to configure automatic restart of the application driver on Yarn
这个问题探讨了 YARN 和 Spark 范围内的可能解决方案。
最佳答案
只是一个想法!
让我们将脚本文件(包含上述脚本)称为 run_spark_job.sh
。
尝试在脚本末尾添加这些语句:
return_code=$?
if [[ ${return_code} -ne 0 ]]; then
echo "Job failed"
exit ${return_code}
fi
echo "Job succeeded"
exit 0
让我们有另一个脚本文件 spark_job_runner.sh
,我们从中调用上面的脚本。例如,
./run_spark_job.sh
while [ $? -ne 0 ]; do
./run_spark_job.sh
done
基于 YARN 的方法:更新 1:这个链接将是一个很好的阅读。它讨论了 YARN REST API 以提交和跟踪:https://community.hortonworks.com/articles/28070/starting-spark-jobs-directly-via-yarn-rest-api.html
更新 2:此链接显示如何使用 Java 将 spark 应用程序提交到 YARN 环境:https://github.com/mahmoudparsian/data-algorithms-book/blob/master/misc/how-to-submit-spark-job-to-yarn-from-java-code.md
基于 Spark 的程序化方法:
How to use the programmatic spark submit capability
YARN 基于 Spark 的配置方法:
用于重新启动的 YARN 模式唯一 spark 参数是 spark.yarn.maxAppAttempts
并且它不应超过 YARN 资源管理器参数 yarn.resourcemanager.am .max-attempts
官方文档摘录https://spark.apache.org/docs/latest/running-on-yarn.html
The maximum number of attempts that will be made to submit the application.
关于hadoop - 在失败或中止时重新运行 Spark 作业,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46999601/
我想在某个条件不满足时中止这个方法,我该怎么做? 我不使用 tableView:willSelectRowAtIndexPath: 方法。我认为可以结合这两种方法来防止某些行被选择并被推送到另一个 V
list->history=(char*)malloc(sizeof(char)); strcpy(list->history,pch2); 当我使用上面的代码时,我无法多次打开该文件。它给了我这个
我试图在退出应用程序后阻止 BroadcastReceiver 出现。到目前为止,我只在安装应用程序时让它显示 Toast。它工作得很好,除了如果我退出应用程序,接收器仍然处于 Activity 状态
当我从 SDK 管理器运行它时,加载过程正常,但一旦完成,模拟器的闪光灯会出现然后很快消失。 有时加载后没有任何反应。 最糟糕的是,当它加载时,我会收到“太多模拟器实例正在这台机器上运行。正在中止”消
./product -rows 4 -cols 4 我收到这个错误: terminate called after throwing an instance of 'std::bad_alloc'
我想要的:我想成为第一个接收短信广播的人,如果我只对短信感兴趣,我想取消广播,这样广播就不会到达任何其他应用程序/接收器(默认消息应用程序ETC。)。我所知道的是: SmsDisptacher.jav
有人知道为什么我会在 LogCat 中收到此警告吗? 01-18 01:18:17.475: W/HardwareRenderer(25992): Attempting to initialize h
我在运行 Kivy hello world 程序时遇到了一个常见的错误。我尝试了我在这里看到的解决方案:手动安装 gstreamer,将其添加到 PATH 并安装 PySDL2。我的操作系统是 Win
这个问题不太可能帮助任何 future 的访问者;它只与一个小的地理区域、一个特定的时间点或一个非常狭窄的情况相关,这些情况并不普遍适用于互联网的全局受众。为了帮助使这个问题更广泛地适用,visit
这三者有什么区别,如果出现我无法正确处理的异常,我应该如何结束程序? 最佳答案 abort 表示程序“异常”结束,并引发 POSIX 信号 SIGABRT,这意味着您为该信号注册的任何处理程序都将被调
我在 .gitconfig 中将 rebase.autoStash 设置为 'true',这样我就可以运行 rebase 在脏工作树上。但是,如果 rebase 由于某种原因中止,则对跟踪文件的所有更
你好,我在 virtualenv 中使用 pyinstaller 创建了一个 kivy python 我的程序在控制台中使用命令 python cipol.py 运行成功,没有错误但是当使用命令 py
.load() jQuery的功能库允许您有选择地从另一个页面加载元素(遵循某些规则)。我想知道是否可以中止加载过程。 在我们的应用程序中,用户可以浏览项目列表。他们可以选择单击一个按钮,该按钮会加载
我最近尝试搁置对Mercurial的更改,并且发生了搁浅的rebase冲突,但最终解决了。此后出了点问题,因为现在当我尝试做其他事情时,出现以下错误: abort: unshelve already
我有一个持续运行的 azure Web 作业,但日志表明周末它的状态更改为“已中止”,然后变为“已停止”。虽然我周末没有使用该网站,但我不确定为什么会发生这种情况,因为队列中仍然有很多消息需要处理。
嗨,我正在编辑构建我的android APK的android docker实例。 我想添加一个checkstyle异常,如果发生任何警告,该异常将导致中止。 我在运行checkstyle的过程中起作用
我有一个具有多个阶段的 Jenkins 管道,例如: node("nodename") { stage("Checkout") { git .... } stage("Check
我的设置是这样的(为了清晰起见,进行了简化): Method 1 FB Method Method 3 ... 因此,每个方法,如果单击,都会淡入内联内容,除了具有“fb
我正在发送一个ajax请求,该请求在选择框的更改事件上调用。现在我想要的是,当向服务器发送新请求时,它将中止所有先前的ajax请求,否则将会有很多同时执行的 ajax 请求数。我只想执行最新的请求。
我有一个 AJAX 请求,它从远程文件中获取数据并显示在页面上的 div 中。当用户将鼠标悬停在链接上时,将调用 AJAX,并显示带有数据的 div,而当鼠标移出链接时,它会消失。 div 会立即显示
我是一名优秀的程序员,十分优秀!