如何找到在计算机不同内核中创建的Spark RDD

2024-03-29 13:30:10 发布

您现在位置:Python中文网/ 问答频道 /正文

我只是想让自己更多地了解火花。所以想问这个问题。在

我已经在本地机器上安装了Spark。16GB的马赫数。在

我连接了一个用Pyspark运行的Jupyter笔记本。在

所以现在当我在笔记本上做任何编码时,比如读取数据并将数据转换成Spark DataFrame,我想检查一下:

(一)。所有数据集都分布在本地计算机上。比如它使用不同的CPU内核来分发数据集等等?。有没有办法找到答案?在

(二)。只使用没有spark的Jupyter笔记本运行代码和计算与使用Pyspark运行Jupyter笔记本不同?就像第一个只使用一个核心的机器和运行使用一个线程,而Jupyter笔记本电脑与Pyspark运行代码和计算在不同的CPU核多线程/处理?这种理解正确吗?。在

有没有办法检查这些。在

谢谢


Tags: 数据代码机器dataframe编码计算机笔记本jupyter
1条回答
网友
1楼 · 发布于 2024-03-29 13:30:10

Jupyter主要有三个部分:Jupyter笔记本、Jupyter客户端和内核。http://jupyter.readthedocs.io/en/latest/architecture/how_jupyter_ipython_work.html

以下是Jupyter主页上关于内核的简短说明。

Kernels are processes that run interactive code in a particular programming language and return output to the user. Kernels also respond to tab completion and introspection requests.

Jupyter的工作是在内核(如python内核、spark Kernel..)和web界面(您的笔记本)之间进行通信。所以在引擎盖下,spark为您运行驱动程序和执行器,Jupyter帮助您与spark驱动程序进行通信。在

1). Where all the dataset is distributed on local machine. Like does it distribute the dataset using different cores of CPU etc?. Is there a way to find that out?

Spark将生成n个数量的执行器(负责执行任务的进程),如使用 num-executors指定的,执行器由Spark驱动程序(负责在Spark引擎上运行作业的程序/进程)管理。所以在运行spark程序时指定了执行器的数量,您将找到这个kernel conf目录。在

2). Running the code and computation just using Jupyter notebook without spark is different from running Jupyter notebook with Pyspark? Like the first one just uses one core of the machine and runs using one thread while Jupyter notebook with Pyspark runs the code and computing on different cores of CPU with multi-threading/processing? Is this understanding correct?.

是的,正如我所解释的,Jupyter只是一个让你运行代码的接口。在幕后,Jupyter连接到内核,不管是普通的Python还是apachespark。在

Spark有自己良好的UI来监视作业,默认情况下它运行在Spark主服务器的4040端口上。在您的情况下,它将在http://localhost:4040上提供

相关问题 更多 >