<div>Hi,</div><div>I am not much of a python programmer and I'm trying to figure out the plugin system.</div><div><br></div><div>I created a ~/.starcluster/plugins directory and put a file in it called shortread.py.</div>
<div>Here are its contents:<br><br></div><div><div>from starcluster.clustersetup import ClusterSetup</div><div>from starcluster.logger import log</div><div><br></div><div>class ShortReadPlugin(ClusterSetup):</div><div> def __init__(self, arg1):</div>
<div> self.arg1 = arg1</div><div> <a href="http://log.info">log.info</a>('arg1 = %s' % arg1)</div><div> def run(self, nodes, master, user, user_shell, volumes):</div><div> <a href="http://log.info">log.info</a>("about to echo")</div>
<div> master.ssh.execute("echo 'hey'")</div></div><div><br></div><div>As you can see, it's just a test.</div><div><br></div><div>In my config, I put this at the bottom:</div><div><div>[plugin shortreadplugin]</div>
<div>SETUP_CLASS = ShortReadPlugin</div><div>arg1=foo</div></div><div><br></div><div>And above in the [global] section I put:</div><div>plugins=shortreadplugin</div><div><br></div><div>I'm a bit confused about whether this is right because in your example:</div>
<div><a href="http://web.mit.edu/stardev/cluster/docs/plugins.html">http://web.mit.edu/stardev/cluster/docs/plugins.html</a></div><div><br></div><div>...you have the SETUP_CLASS as ubuntu.PackageInstaller. I'm not sure where the "ubuntu" fits into this. Is it like java where I need to have a folder called ubuntu where the class resides?</div>
<div><br></div><div>Anyway, I fired up my cluster and went to test this with "starcluster shell" and got the following output:</div><div><br></div><div>In [5]: cluster.run_plugin('shortreadplugin', 'myfirstcluster', cfg)</div>
<div>---------------------------------------------------------------------------</div><div>TypeError Traceback (most recent call last)</div><div><br></div><div>/Library/Python/2.6/site-packages/StarCluster-0.91-py2.6.egg/starcluster/cli.pyc in <module>()</div>
<div>----> 1 </div><div> 2 </div><div> 3 </div><div> 4 </div><div> 5 </div><div><br></div><div>/Library/Python/2.6/site-packages/StarCluster-0.91-py2.6.egg/starcluster/cluster.pyc in run_plugin(plugin_name, cluster_tag, cfg)</div>
<div> 170 def run_plugin(plugin_name, cluster_tag, cfg):</div><div> 171 ec2 = cfg.get_easy_ec2()</div><div>--> 172 cl = get_cluster(cluster_tag)</div><div> 173 cl.load_receipt()</div><div> 174 plug = cfg.get_plugin(plugin_name)</div>
<div><br></div><div>TypeError: get_cluster() takes exactly 2 arguments (1 given)</div><div><br></div><div><br></div><div>It's hard for me to understand what's happening here. I of course am not calling get_cluster directly. Is there a bug in run_plugin() or is there something wrong in my setup, or both?</div>
<div><br></div><div>Thanks</div><div>Dan</div><div><br></div>