How to limit the number of retries on Spark job fa

2019-01-12 06:16发布

We are running a Spark job via spark-submit, and I can see that the job will be re-submitted in the case of failure.

How can I stop it from having attempt #2 in case of yarn container failure or whatever the exception be?

enter image description here

3条回答
相关推荐>>
2楼-- · 2019-01-12 06:35

There are two settings that control the number of retries (i.e. the maximum number of ApplicationMaster registration attempts with YARN is considered failed and hence the entire Spark application):

  • spark.yarn.maxAppAttempts - Spark's own setting. See MAX_APP_ATTEMPTS:

    private[spark] val MAX_APP_ATTEMPTS = ConfigBuilder("spark.yarn.maxAppAttempts")
      .doc("Maximum number of AM attempts before failing the app.")
      .intConf
      .createOptional
    
  • yarn.resourcemanager.am.max-attempts - YARN's own setting with default being 2.

(As you can see in YarnRMClient.getMaxRegAttempts) the actual number is the minimum of the configuration settings of YARN and Spark with YARN's being the last resort.

查看更多
时光不老,我们不散
3楼-- · 2019-01-12 06:35

An API/programming language-agnostic solution would be to set the yarn max attempts as a command line argument:

spark-submit --conf spark.yarn.maxAppAttempts=1 <application_name>

See @code 's answer

查看更多
可以哭但决不认输i
4楼-- · 2019-01-12 06:41

Add the property yarn.resourcemanager.am.max-attempts to your yarn-default.xml file. It specifies the maximum number of application attempts.

For more details look into this link

查看更多
登录 后发表回答