first commit
[bl_monitoring.git] / tools / archiving_extraction / archiving_elem.py
blob708d97a490af633080d860c06f4306887322fc55
1 #!/usr/bin/env python
3 ##########################
4 import sys, os, time
6 from bl_instance.build_bl import *
8 from archiving import *
9 ##############################
14 ##############################################################################################
15 if __name__ == '__main__':
18 if len(sys.argv) < 3:
19 print "\nCorrect use: " + sys.argv[0] + " start/stop/check ELEM_NICKNAME [tdb/hdb]\n"
20 sys.exit(0)
22 action = sys.argv[1]
24 nicknames_elems = dict([(elem.nickname, elem) for elem in beam_path + continuous_env])
25 elem_nickname = sys.argv[2]
26 if not elem_nickname in nicknames_elems.keys():
27 print "\nCorrect use: " + sys.argv[0] + " start/stop/check ELEM_NICKNAME [tdb/hdb]\n"
28 print "Invalid ELEM_NICKNAME"
29 sys.exit(0)
31 db = 'Tdb'
32 if len(sys.argv) == 4:
33 db = sys.argv[3]
35 bl_elem = nicknames_elems[elem_nickname]
37 if bl_elem.params:
38 attrs_archiModes = dict( [(p.attr_fullName, p.archiving_mode.split())
39 for p in bl_elem.params] )
40 elif isinstance(bl_elem, beam_stopper):
41 attrs_archiModes = dict( [(bl_elem.beamAccess_param.attr_fullName,
42 bl_elem.beamAccess_param.archiving_mode.split())] )
43 else:
44 print 'coucou'
45 sys.exit(0)
47 archiving(attrs_archiModes, action, db)