[StarCluster] development shell - unbound method run_plugin() must be called with Cluster instance
Justin Riley
jtriley at MIT.EDU
Fri Mar 4 14:04:59 EST 2011
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi Stuart,
First of all the docs have not yet been updated for the latest github
code and my apologies for this. I've been insanely busy with another
project the last couple months and am just now getting back to sanity.
In any event it appears you're using the latest github code and you've
discovered you need the ClusterManager which is correct. However, your
usage is slightly off (although it works). Doing this completely
manually would involve:
from starcluster import config
from starcluster import cluster
cfg = config.StarClusterConfig()
cm = cluster.ClusterManager(cfg)
cm.run_plugin('automount', 'smallcluster')
BTW if you use "starcluster shell" with the github code you
automatically have a ClusterManager object available to you as the "cm"
variable:
$ starcluster shell
StarCluster - (http://web.mit.edu/starcluster) (v. 0.9999)
Software Tools for Academics and Researchers (STAR)
Please submit bug reports to starcluster at mit.edu
>>> Importing module config
>>> Importing module plugins
>>> Importing module cli
>>> Importing module awsutils
>>> Importing module balancers
>>> Importing module ssh
>>> Importing module utils
>>> Importing module static
>>> Importing module exception
>>> Importing module cluster
>>> Importing module node
>>> Importing module clustersetup
>>> Importing module image
>>> Importing module volume
>>> Importing module tests
>>> Importing module templates
>>> Importing module optcomplete
>>> Importing module commands
>>> Importing module boto
>>> Importing module paramiko
[starcluster/starcluster]|1> cm
<1> <ClusterManager: us-east-1>
[starcluster/starcluster]|2> cm.list_clusters()
>>> No clusters found...
Hope that helps,
~Justin
On 02/10/2011 12:30 AM, Stuart Young wrote:
> Hi All,
>
> Fyi, I figured out I needed ClusterManager (not Cluster). Here's the way
> to access the ClusterManager **instance** (i.e., not the type):
>
> clus = cluster.ClusterManager(cfg)
> cluster.ClusterManager.run_plugin(clus, 'automount', 'smallcluster')
>
>
> Cheers,
>
> Stuart
>
>
> On 2/9/2011 6:22 PM, Stuart Young wrote:
>> (Sorry - reposting with correct subject)
>>
>> Hi All,
>>
>> I'm having some trouble debugging my plugin inside the StarCluster
>> development shell.
>>
>> I've created a plugin called automount.py like so:
>>
>> class NfsShares (ClusterSetup):
>> """
>> Automatically mounts external NFS shares on StarCluster nodes
>> """
>> def __init__(self, head_ip):
>> log.info("AutoMount.__init__ Running AutoMount plugin.")
>> ...
>>
>> .. and placed it in the ~/.starcluster/plugins directory and filled in
>> the config file as described in the documentation here:
>> http://web.mit.edu/stardev/cluster/docs/plugins.html
>>
>> I started a cluster okay with:
>>
>> starcluster start smallcluster
>>
>> But when I come to test my plugin inside the development shell according
>> to the following instructions:
>>
>> 3. Launch the development shell and test your plugin on your small
>> test cluster
>>
>> $ starcluster shell
>> [~]|1> cluster.run_plugin('myplugin', 'testcluster', cfg)
>>
>> ... I run this command inside the shell:
>>
>> cluster.run_plugin('automount', 'smallcluster', cfg)
>>
>> ... and get this error message:
>>
>> AttributeError: 'module' object has no attribute 'run_plugin'
>>
>> So I tried the cluster.Cluster object since it has the 'run_plugin' method:
>>
>> cluster.Cluster.run_plugin(cluster.Cluster, 'automount', 'smallcluster',
>> cfg)
>>
>> ... but I get this error message:
>>
>> TypeError: unbound method run_plugin() must be called with Cluster
>> instance as first argument (got type instance instead)
>>
>> Am I going about this the right way?
>>
>> Cheers,
>>
>> Stuart
>>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk1xN9sACgkQ4llAkMfDcrnYUwCgkyru3ke28xEWRJyb0NugKsi/
poYAoIoyGbcmICwQKIrdFRdi1LyPVUie
=33uh
-----END PGP SIGNATURE-----
More information about the StarCluster
mailing list