source: trunk/Monitoring/Failover/failover

Last change on this file was 842, checked in by jripsl, 11 years ago
  • add sample.
  • Property svn:executable set to *
File size: 1.2 KB
Line 
1#!/usr/bin/python -u
2# -*- coding: ISO-8859-1 -*-
3
4##################################
5#  @program        smon
6#  @description    simulation monitor
7#  @copyright      Copyright “(c)2009 Centre National de la Recherche Scientifique CNRS.
8#                             All Rights Reserved”
9#  @svn_file       $Id: failover 2545 2013-02-01 09:58:10Z jripsl $
10#  @version        $Rev: 2545 $
11#  @lastrevision   $Date: 2013-02-01 10:58:10 +0100 (Fri, 01 Feb 2013) $
12#  @license        CeCILL (http://dods.ipsl.jussieu.fr/jripsl/smon/LICENSE)
13##################################
14
15from smon import dao
16
17CSTE_SIMULATION_STATUS_OK="2.2"
18
19class Failover():
20        running=true
21
22        @classmethod
23        def controlLoop(cls):
24
25                while cls.running is True:
26
27                        simulation=dao.get_simulation()
28
29                        if simulation.status
30                               
31                        sleep 20
32
33def main():
34
35        # parse args
36        parser = argparse.ArgumentParser(prog='failover')
37        parser.add_argument('-v', dest='verbose',required=False,action='store_true')
38        args = parser.parse_args()
39
40        # check
41        if not os.path.exists(SMON.smon_home):
42                sys.exit(1)
43
44        SMON.init_singleton()
45
46        Failover.controlLoop()
47
48        SMON.free_singleton()
49
50
51if __name__ == '__main__':
52        try:
53                main()
54
55                sys.exit(0)
56
57        except Exception, e:
58
59                #traceback.print_exc()
60
61                sys.exit(1)
Note: See TracBrowser for help on using the repository browser.