Ejemplo n.º 1
0
class MonitorDaemon(Daemon):
    def run(self):
        import signal

        init = self.args[0];
        
        self.m = Monitor( self.home, init=init );
        
        if not self.m.spawn():
            self.m.remove();
            sys.exit(1);
        
        try:
            self.m.run();
        except Exception, e:
            import traceback
            self.m.log(traceback.format_exc());
Ejemplo n.º 2
0
def c_clean(p, h, args):
    if len(args) > 0:
        r = h.select_runs(args.pop());
    else:
        r = h.select_runs();
    
    for f in r:
        m = Monitor( h, f );
        result = m.communicate( commands.Ping() );
        
        if result and isinstance( result, commands.Pong ):
            p.info( "Got Pong:", f )
            continue;
        
        p.info( "Timeout, removing:", f )
        m.remove();
    
    if len(r) == 0:
        p.info( "Nothing to clean" )