简体   繁体   English

AWS EMR-如何在所有从属节点上自动编辑文件?

[英]AWS EMR - How to automatically edit file on all slave nodes?

I am running a Python script on all slave nodes of an AWS EMR cluster. 我在AWS EMR集群的所有从节点上运行Python脚本。 I need to configure matplotlib to use non-interactive backend on each slave node, otherwise I will run into an error ( detailed description provided here ) 我需要将matplotlib配置为在每个从属节点上使用非交互式后端,否则我将遇到错误( 此处提供了详细说明

My current solution is to manually ssh into each slave node and to manually edit /usr/local/lib64/python2.7/site-packages/matplotlib/mpl-data/matplotlibrc: 我当前的解决方案是手动ssh进入每个从节点并手动编辑/usr/local/lib64/python2.7/site-packages/matplotlib/mpl-data/matplotlibrc:

backend : agg

Obviously, this approach is very time-consuming and inefficient. 显然,这种方法非常耗时且效率低下。

Can anyone provide a small (pseudo) code snippet which performs this task automatically on all slave nodes? 谁能提供一个小的(伪)代码片段,该片段在所有从属节点上自动执行此任务?

Simplest solution is to provide a shell script via bootstrap action after Amazon EMR launches the instance: 最简单的解决方案是在Amazon EMR启动实例后通过引导操作提供shell脚本:

#! /bin/sh
sudo sed -i 's/TkAgg/agg/g' /usr/local/lib64/python2.7/site-packages/matplotlib/mpl-data/matplotlibrc

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM