Numpy 和 Scipy 与 Amazon Elastic MapReduce

发布于 2024-12-15 07:13:05 字数 536 浏览 6 评论 0原文

使用 mrjob 在 Amazon Elastic MapReduce 上运行 python 代码,我成功找到了升级 EMR 映像的 numpy 和 scipy 的方法。

从控制台运行以下命令可以工作:

    tar -cvf py_bundle.tar mymain.py Utils.py numpy-1.6.1.tar.gz scipy-0.9.0.tar.gz

    gzip py_bundle.tar 

    python my_mapper.py -r emr --python-archive py_bundle.tar.gz --bootstrap-python-package numpy-1.6.1.tar.gz --bootstrap-python-package scipy-0.9.0.tar.gz > output.txt 

这成功地将最新的 numpy 和 scipy 引导到图像中并完美运行。我的问题是速度问题。在小型实例上安装需要 21 分钟。

有谁知道如何加快升级过程 numpy 和 scipy 吗?

Using the mrjob to run python code on Amazon's Elastic MapReduce I have successfully found a way to upgrade the EMR image's numpy and scipy.

Running from console the following commands work:

    tar -cvf py_bundle.tar mymain.py Utils.py numpy-1.6.1.tar.gz scipy-0.9.0.tar.gz

    gzip py_bundle.tar 

    python my_mapper.py -r emr --python-archive py_bundle.tar.gz --bootstrap-python-package numpy-1.6.1.tar.gz --bootstrap-python-package scipy-0.9.0.tar.gz > output.txt 

This successfully bootstraps the latest numpy and scipy into the image and works perfectly. My question is a matter of speed. This takes 21 minutes to install itself on a small instance.

Does anyone have any idea how to speed up the process of upgrading
numpy and scipy?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

书间行客 2024-12-22 07:13:05

对 EMR 映像执行任何操作的唯一方法是使用引导操作。从控制台执行此操作意味着您将仅更改主节点,而不会更改执行处理的任务节点。引导操作在启动时在所有节点上运行一次,并且可以是一个获取 shell 执行的简单脚本。

elastic-mapreduce --create --bootstrap-action "s3://bucket/path/to/script" ...

要加快对 EMR 映像的更改,请压缩安装后的文件并上传到 S3。然后使用引导操作来下载和部署。您必须为 32 位(微型、小型、中型)和 64 位计算机保留单独的存档。

脚本中从S3下载的命令是:

hadoop fs -get s3://bucket/path/to/archive /tmp/archive

The only way to do anything to an EMR image is by using bootstrap actions. Doing this from the console means you'll only change the master node and not the task nodes which do the processing. Bootstrap actions run once at startup on all nodes and can be a simple script that gets shell exec'd.

elastic-mapreduce --create --bootstrap-action "s3://bucket/path/to/script" ...

To speed up changes to the EMR image, tar up the post-installed files and upload to S3. Then use a bootstrap action to download and deploy. You will have to keep separate archives for 32 bit (micro, small, medium) and 64 bit machines.

The command to download from S3 in the script is:

hadoop fs -get s3://bucket/path/to/archive /tmp/archive
难忘№最初的完美 2024-12-22 07:13:05

这个问题的当前答案是 NumPy 已经安装在 EMR 上。

如果您想将 NumPy 更新到比可用版本更新的版本,您可以运行一个执行 sudo yum -y install numpy 的脚本(作为引导操作)。 NumPy 很快就安装好了。

The current answer to this question is that NumPy is already installed on EMR, now.

If you want to update NumPy to a more recent version than the one available, you can run a script (as a bootstrap action) that does sudo yum -y install numpy. NumPy is then installed in no time.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文