0

I am running a Python script on all slave nodes of an AWS EMR cluster. 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)

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:

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?

kanimbla
  • 858
  • 1
  • 9
  • 23
  • Is it the same script that you run on all nodes? In that case the script itself could set the backend to `"Agg"`. – ImportanceOfBeingErnest Mar 26 '18 at 19:36
  • Yes, the python script to be executed is the same on all nodes. Good idea actually to set the backend from the python script, I will look into it. Thanks – kanimbla Mar 26 '18 at 20:05

1 Answers1

0

Simplest solution is to provide a shell script via bootstrap action after Amazon EMR launches the instance:

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