first commit
[bl_monitoring.git] / tools / archiving_extraction / archiving_attr.py
blob05f1ab54714c8b8f9266f730dce7f3d476587c45
1 #!/usr/bin/env python
3 ##########################
4 import sys, os, time
7 from bl_instance.build_bl import *
9 from archiving import *
10 ########################
16 ############################################################################
17 if __name__ == '__main__':
20 if len(sys.argv) < 3:
21 print "\nCorrect use: " + sys.argv[0] + " start/stop/check ATTR_FULLNAME [tdb/hdb]\n"
22 sys.exit(0)
24 action = sys.argv[1]
25 attr_fullname = sys.argv[2]
27 if action == 'start':
28 attr_found = False
29 for elem in beam_path + continuous_env:
31 attrs_params = dict( [(p.attr_fullName, p) for p in (elem.params)] )
33 if attr_fullname in attrs_params.keys():
34 archi_mode = attrs_params[attr_fullname].archiving_mode.split()
35 attr_found = True
36 break
38 if not attr_found:
39 print "\nCorrect use: " + sys.argv[0] + " start/stop/check ATTR_FULLNAME [tdb/hdb]\n"
40 print "Invalid ATTR_FULLNAME"
41 sys.exit(0)
43 db = 'Tdb'
44 if len(sys.argv) == 4:
45 db = sys.argv[3]
47 if action == 'start':
48 attrs_archiModes = dict( [(attr_fullname, archi_mode)] )
49 else:
50 attrs_archiModes = dict( [(attr_fullname, ['MODE_P', '1000'])] )
53 archiving(attrs_archiModes, action, db)