[Starcluster] Using starcluster as a library

Austin Godber godber at uberhip.com
Sat May 15 17:11:34 EDT 2010


For those following along at home, lsof clearly revealed open SSH 
connections (actually I only checked with lsof with a single node 
cluster).  So if I loop over all the clusters nodes and do _ssh.close() 
on each one, the program exits.  I didn't see anything in cli.py that 
does this and there was no other obvious function that appeared to do 
this.  I am not sure if this is intended behavior or I have missed 
something.

Have a good day,
Austin


PS - The following is a working program.  It was tested on a two node 
cluster, I am not sure whether it was just the master or other nodes 
that had connections open.


#!/usr/bin/env python
import starcluster.config

if __name__ == "__main__":
     cfg = starcluster.config.StarClusterConfig(); cfg.load()
     sc =  cfg.get_cluster_template('smallcluster', 'mynewcluster')
     if sc.is_valid():
         sc.start(create=True)
     # close all SSH connections so we can exit:
     for node in sc._nodes:
         node._ssh.close()


On 05/15/2010 09:22 AM, Austin Godber wrote:
> I am playing with using starcluster as a library and its been
> straightforward and easy to use so far with the exception of after I
> start the cluster the code doesn't return.  Cluster launches fine.  Are
> there some connections I need to close?  I have taken a look at
> cluster.start and theres nothing apparent.
>
> Anyone know offhand?  Otherwise I will dig into it this afternoon.
>
> Thanks!
>
> - Austin
>
>
> The code's trivial and essentially the snippet from the end of cluster.py:
>
>
> #!/usr/bin/env python
>
> import starcluster.config
>
> if __name__ == "__main__":
>       cfg = starcluster.config.StarClusterConfig(); cfg.load()
>       sc =  cfg.get_cluster_template('smallcluster', 'mynewcluster')
>       if sc.is_valid():
>           sc.start(create=True)
>    



More information about the StarCluster mailing list