[StarCluster] Using starcluster as a library

Justin Riley justin.t.riley at gmail.com
Fri Mar 4 13:46:27 EST 2011


Hi Jeff,

Sorry for the delay. StarCluster is indeed intended to be used as a
library in addition to an application, however, until an official 1.0
release the API is subject to change. With that said I try my best not
to change things around too drastically if I don't have.

In order to enable the logging system used in StarCluster you need to
call the configure_sc_logging() method:

from starcluster import logger
logger.configure_sc_logging()

The reason this is required is that logging is really application
specific and the logging configuration used in StarCluster is specific
to the StarCluster application (ie the starcluster command line tool).

Some folks that script against StarCluster might want to configure the
logging system in a completely different way than the StarCluster
command line application. For example they might want to change the
format of the messages, where the logs are stored by default, enable
remote logging, etc. They might even want to disable the logging
messages from StarCluster altogether or just configure them to always go
to a file rather than the screen. So by default the StarCluster logging
configuration is not enabled just by importing the library and instead
must be explicitly enabled by the application developer using the
logger.configure_sc_logging() method.

Hope that helps,

~Justin



On 02/15/2011 08:58 PM, Jeff White wrote:
> I just joined the list and am responding to a post back in May 2010 with
> the same subject. I wrote this python script as recommended by Justin:
> 
> def main():
>      cfg = starcluster.config.StarClusterConfig(); cfg.load()
> 
>      sc =  cfg.get_cluster_template('smallcluster', 'mynewcluster')
>      if sc.is_valid():
>          sc.start(create=True)
> 
> if __name__ == "__main__":
>      main()
> 
> 
> The instances were created, but the only output I get is this instead of
> the usual status messages about the master node and installing SGE etc.
> 
> Reservation:r-74f42b19
> 2/2
> |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
> 100% 
> 2/2
> |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
> 100% 
> 
> My guess is that starcluster.logger needs to be imported in some way,
> but I haven't figured out how. I'm new to starcluster and python, so I
> may be missing something obvious. I hope that using starcluster in this
> way is not considered a hack, and is somewhat officially supported. This
> gives me convenient access to cluster values, which I don't get by using
> the command-line tools.
> 
> thanks,
> jeff
> 
> 
> 
> _______________________________________________
> StarCluster mailing list
> StarCluster at mit.edu
> http://mailman.mit.edu/mailman/listinfo/starcluster




More information about the StarCluster mailing list