首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Dataproc: PySpark登录到GCS桶

Dataproc: PySpark登录到GCS桶
EN

Stack Overflow用户
提问于 2022-10-14 06:27:28
回答 1查看 114关注 0票数 2

我在Dataproc中运行了一个pyspark作业。目前,我们正在登录控制台/纱线日志。根据我们的要求,我们需要将日志存储在GCS桶中。有没有一种方法可以直接登录到GCS中带有python日志模块的文件?

我尝试用下面的配置设置日志模块。但是它抛出了一个错误(FileNotFoundError: Errno 2没有这样的文件或目录:'/gs:/bucket_name/newfile.log')

logging.basicConfig(filename="gs://bucket_name/newfile.log", format='%(asctime)s %(message)s', filemode='w')

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-10-16 02:07:09

默认情况下,yarn:yarn.log-aggregation-enable设置为true,而yarn:yarn.nodemanager.remote-app-log-dir设置为Dataproc 1.5+上的gs://<cluster-tmp-bucket>/<cluster-uuid>/yarn-logs,因此在GCS dir中聚合纱线容器日志,但可以用

代码语言:javascript
运行
复制
gcloud dataproc clusters create ... \
  --properties yarn:yarn.nodemanager.remote-app-log-dir=<gcs-dir>

或将集群的tmp桶更新为

代码语言:javascript
运行
复制
gcloud dataproc clusters create ... --temp-bucket <bucket>

请注意,

如果您的

  • 作业处于client模式(默认值),那么Spark驱动程序将在主节点上运行,而不是在纱线中运行,驱动程序日志存储在Dataproc生成的作业属性driverOutputResourceUri中,该属性属性是集群的暂存桶中的一个特定于作业的文件夹。否则,在集群模式下,火花驱动程序在纱线中运行,驱动程序日志是纱线容器日志,并按照上面的描述进行聚合。

如果要禁用群集的云日志记录,请设置

  • ,设置dataproc:dataproc.logging.stackdriver.enable=false。但请注意,它将禁用所有类型的云日志记录,包括纱线容器日志、启动日志和服务日志。
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/74065164

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档