Last change
on this file since 1530 was
841,
checked in by jripsl, 11 years ago
|
- add static class initialisation function.
|
-
Property svn:executable set to
*
|
File size:
1.3 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: runchecker 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 | |
---|
15 | from smon import dao |
---|
16 | |
---|
17 | class RunChecker(): |
---|
18 | |
---|
19 | @classmethod |
---|
20 | def check(cls): |
---|
21 | simulation=dao.get_simulation() |
---|
22 | |
---|
23 | m=simulation.get_last_message() |
---|
24 | |
---|
25 | if (current_date-m.timestamp).days > 2: |
---|
26 | |
---|
27 | print "simulation too old" |
---|
28 | |
---|
29 | messages=simulation.get_messages() |
---|
30 | |
---|
31 | for m in messages: |
---|
32 | |
---|
33 | pass |
---|
34 | |
---|
35 | |
---|
36 | |
---|
37 | def main(): |
---|
38 | |
---|
39 | # parse args |
---|
40 | parser = argparse.ArgumentParser(prog='runchecker') |
---|
41 | parser.add_argument('-v', dest='verbose',required=False,action='store_true') |
---|
42 | args = parser.parse_args() |
---|
43 | |
---|
44 | # check |
---|
45 | if not os.path.exists(SMON.smon_home): |
---|
46 | sys.exit(1) |
---|
47 | |
---|
48 | SMON.init_singleton() |
---|
49 | |
---|
50 | RunChecker.check() |
---|
51 | |
---|
52 | SMON.free_singleton() |
---|
53 | |
---|
54 | if __name__ == '__main__': |
---|
55 | try: |
---|
56 | main() |
---|
57 | |
---|
58 | sys.exit(0) |
---|
59 | |
---|
60 | except Exception, e: |
---|
61 | |
---|
62 | #traceback.print_exc() |
---|
63 | |
---|
64 | sys.exit(1) |
---|
Note: See
TracBrowser
for help on using the repository browser.