本文介绍了来自..错误有效载荷的无效状态代码"400":“要求失败:会话未激活的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行Pyspark脚本,将数据帧写入jupyter Notebook中的csv,如下所示:

I am running Pyspark scripts to write a dataframe to a csv in jupyter Notebook as below:

df.coalesce(1).write.csv('Data1.csv',header = 'true')

运行一个小时后,出现以下错误.

After an hour of runtime I am getting the below error.

我的配置就像:

spark.conf.set("spark.dynamicAllocation.enabled","true")
spark.conf.set("shuffle.service.enabled","true")
spark.conf.set("spark.dynamicAllocation.minExecutors",6)
spark.conf.set("spark.executor.heartbeatInterval","3600s")
spark.conf.set("spark.cores.max", "4")
spark.conf.set("spark.sql.tungsten.enabled", "true")
spark.conf.set("spark.eventLog.enabled", "true")
spark.conf.set("spark.app.id", "Logs")
spark.conf.set("spark.io.compression.codec", "snappy")
spark.conf.set("spark.rdd.compress", "true")
spark.conf.set("spark.executor.instances", "6")
spark.conf.set("spark.executor.memory", '20g')
spark.conf.set("hive.exec.dynamic.partition", "true")
spark.conf.set("hive.exec.dynamic.partition.mode", "nonstrict")
spark.conf.set("spark.driver.allowMultipleContexts", "true")
spark.conf.set("spark.master", "yarn")
spark.conf.set("spark.driver.memory", "20G")
spark.conf.set("spark.executor.instances", "32")
spark.conf.set("spark.executor.memory", "32G")
spark.conf.set("spark.driver.maxResultSize", "40G")
spark.conf.set("spark.executor.cores", "5")

我已经检查了容器节点,并且存在错误:

I have checked the container nodes and the error there is:

ExecutorLostFailure (executor 2 exited caused by one of the running tasks) Reason: Container marked as failed:container_e836_1556653519610_3661867_01_000005 on host: ylpd1205.kmdc.att.com. Exit status: 143. Diagnostics: Container killed on request. Exit code is 143

无法找出问题所在.

推荐答案

从输出来看,如果您的应用程序未以FAILED状态完成,则听起来像是Livy超时错误:您的应用程序可能花费的时间比定义的时间长Livy会话超时(默认为1h),因此,即使Spark应用程序成功运行,但如果该应用程序花费的时间超过Livy会话的超时时间,您的笔记本仍会收到此错误.

Judging by the output, if your application is not finishing with a FAILED status, that sounds like a Livy timeout error: your application is likely taking longer than the defined timeout for a Livy session (which defaults to 1h), so even despite the Spark app succeeds your notebook will receive this error if the app takes longer than the Livy session's timeout.

如果是这种情况,请按以下步骤处理:

If that's the case, here's how to address it:

  1. 编辑/etc/livy/conf/livy.conf文件(在集群的主目录中节点)
  2. livy.server.session.timeout设置为较高的值,例如8h(或更大,取决于您的应用程序)
  3. 重新启动Livy以更新设置:集群主服务器中的sudo restart livy-server
  4. 再次测试您的代码
  1. edit the /etc/livy/conf/livy.conf file (in the cluster's masternode)
  2. set the livy.server.session.timeout to a higher value, like 8h (or larger, depending on your app)
  3. restart Livy to update the setting: sudo restart livy-server in the cluster's master
  4. test your code again

这篇关于来自..错误有效载荷的无效状态代码"400":“要求失败:会话未激活的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-11 08:05