OK, I figured out that the plugin needs to be in a file called "something.py" and then you can refer to it in the config as "something.MyPluginClass".<div><br></div><div>I re-launched my cluster and I am not seeing output from my plugin in either the console or log.</div>
<div><br></div><div>Also, still getting the same error (below) in the development shell.</div><div><br></div><div>Thanks</div><div>Dan</div><div><br></div><div><br><div class="gmail_quote">On Sat, Oct 30, 2010 at 11:00 AM, Dan Tenenbaum <span dir="ltr"><<a href="mailto:dtenenba@fhcrc.org">dtenenba@fhcrc.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div><div></div><div class="h5"><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" target="_blank">log.info</a>('arg1 = %s' % arg1)</div><div> def run(self, nodes, master, user, user_shell, volumes):</div><div> <a href="http://log.info" target="_blank">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" target="_blank">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>
</div></div><br>_______________________________________________<br>
StarCluster mailing list<br>
<a href="mailto:StarCluster@mit.edu">StarCluster@mit.edu</a><br>
<a href="http://mailman.mit.edu/mailman/listinfo/starcluster" target="_blank">http://mailman.mit.edu/mailman/listinfo/starcluster</a><br>
<br></blockquote></div><br></div>