我在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')
发布于 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中聚合纱线容器日志,但可以用
gcloud dataproc clusters create ... \
--properties yarn:yarn.nodemanager.remote-app-log-dir=<gcs-dir>或将集群的tmp桶更新为
gcloud dataproc clusters create ... --temp-bucket <bucket>请注意,
如果您的
driverOutputResourceUri中,该属性属性是集群的暂存桶中的一个特定于作业的文件夹。否则,在集群模式下,火花驱动程序在纱线中运行,驱动程序日志是纱线容器日志,并按照上面的描述进行聚合。如果要禁用群集的云日志记录,请设置
dataproc:dataproc.logging.stackdriver.enable=false。但请注意,它将禁用所有类型的云日志记录,包括纱线容器日志、启动日志和服务日志。https://stackoverflow.com/questions/74065164
复制相似问题