Created
August 9, 2012 19:28
-
-
Save jtriley/3307331 to your computer and use it in GitHub Desktop.
Example StarCluster plugin that configures environment variables on all nodes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is an example config that assumes scenv.py is either in | |
# $HOME/.starcluster/plugins or lives somewhere in your $PYTHONPATH | |
[plugin env] | |
setup_class = scenv.EnvPlugin | |
# add as many key=value pairs as you like separated by ',' | |
env_vars_list = 'PYTHONPATH=/path/to/python/mods, MYENV=some_value' | |
[cluster default] | |
... | |
plugins = env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install this file to $HOME/.starcluster/plugins/scenv.py or somewhere on your $PYTHONPATH | |
from starcluster.clustersetup import ClusterSetup | |
from starcluster.logger import log | |
class EnvPlugin(ClusterSetup): | |
def __init__(self, env_vars_list): | |
self.env_vars_list = '\n'.join([v.strip() for v in env_vars_list.split(',')]) | |
def run(self, nodes, master, user, user_shell, volumes): | |
log.info("Setting environment on all nodes...") | |
for node in nodes: | |
env_file = node.ssh.remote_file('/etc/profile.d/scenv.sh', 'w') | |
env_file.write(self.env_vars_list) | |
env_file.close() |
Trying the comment and no love.. nothing written to .bashrc and no env variables added.. trying to replace base python with anaconda
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
should there be an 'export' in the config example?
eg I am getting this:
starcluster sshmaster pyart_sc
Last login: Thu Jan 21 21:09:54 2016 from ip-172-31-55-102.ec2.internal
-bash: PATH=/home/ubuntu/anaconda2/bin:$PATH: No such file or directory