[StarCluster] accessing cluster object from a plugin

Justin Riley jtriley at MIT.EDU
Mon Dec 20 17:17:10 EST 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hey Guys,

Sorry for dropping the ball on this one. I'd like to avoid passing in
the entire Cluster object if I can help it. The next version will have a
'groups' attribute in the Node class. For now you can access the various
groups that a node is a member of by using the groups attribute in the
Node class's instance attribute:

 In[1] groups = n.instance.groups
 In[2] g = groups[0]
 In[3] print g.id
Out[3] '@sc-mycluster'

Checking whether a group is a starcluster name is simply a matter of
testing whether the g.id starts with static.SECURITY_GROUP_PREFIX:

 In[4] is_cluster_group = g.id.startswith(static.SECURITY_GROUP_PREFIX)

In the next version accessing the groups will simply be:

In[1] n.groups

This will contain *all* security groups. We will also have a
cluster_groups attribute in the next version for listing *only* cluster
security groups:

In[2] n.cluster_groups

Last, for the time being you can access the *boto* ec2 connection object
(not EasyEC2) which will allow you to make boto calls to EC2 via the
n.instance.connection attribute:

In[1] n.instance.connection.authorize_security_group(...)

Keep in mind this n.instance.connection object is a *boto* ec2
connection not StarCluster's EasyEC2 connection. In the next version you
will have an 'ec2' attribute in the Node class that will allow you to
make aws/ec2 calls via the EasyEC2 object.

Does this make sense?

~Justin

On 12/20/2010 04:08 PM, Dan Yamins wrote:
> Any further info on this?
> 
> On Wed, Dec 15, 2010 at 7:23 PM, Dan Yamins <dyamins at gmail.com
> <mailto:dyamins at gmail.com>> wrote:
> 
>     I'm interested to know this as well ...   Justin, you were saying
>     something about the cluster object being passed to the run method,
>     in the github code? 
> 
>     D
> 
>     On Tue, Dec 7, 2010 at 1:27 PM, Igor Tatarinov <igor at priceyeti.com
>     <mailto:igor at priceyeti.com>> wrote:
> 
>         I can't figure out if it's possible. I just need to know the
>         cluster security group.
> 
>         The arg list doesn't include 'cluster':
>         def run(self, nodes, master, user, user_shell, volumes):
> 
>         and it doesn't seem possible to get to the cluster from a node
>         object.
> 
> 
> 
>         _______________________________________________
>         StarCluster mailing list
>         StarCluster at mit.edu <mailto:StarCluster at mit.edu>
>         http://mailman.mit.edu/mailman/listinfo/starcluster
> 
> 
> 

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.16 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk0P1eYACgkQ4llAkMfDcrlbmACgiRUIoGbyudESdtc4snhPc4eb
vd4AnRMi5tz9shbndEk8EivOnqNGC3y6
=EsJG
-----END PGP SIGNATURE-----



More information about the StarCluster mailing list