2 """This module provides the PID and the log file name of the running DQM
3 applications (consumers), thus completing the information generated by
6 When used as a script the following options are accepted:
13 import ExtractAppInfoFromXML
as appinf
19 print "Connecting to server: "+srv+
" and fetching PID for application running on port: "+port
20 cf=os.popen(
'ssh '+srv+
' ps -eo pid,cmd | grep '+port)
24 return "App Not Running"
30 sys.stderr.write(
"Something went really bad\n" )
36 if pid==
"App Not Running":
37 return "No active log file"
39 print "Connecting to server: "+srv+
" and fetching LogFile for application with PID: "+pid
40 cf=os.popen(
'ssh '+srv+
' ls -l /tmp | grep '+pid)
44 return "App Not Running???"
54 (table,grid)=appinf.getAppInfo(filename,2,1,3,4)
62 if __name__ ==
"__main__":
66 (args,filename)=gop.getopt(sys.argv[1:],
"hf",[
"help"])
67 except getopt.GetoptError:
68 sys.stderr.write(
"Sintax Error unrecognised option" )
69 sys.stderr.write( __doc__ )
77 elif item[0]==
"--help":
78 sys.stdout.write(__doc__)
81 sys.stderr.write(
"\nERROR: xdaq XML config file name not present, please specify\n\n" )
82 sys.stdout.write(__doc__)
83 elif len(filename) > 1:
84 sys.stderr.write(
"\nERROR: Too many file names or other arguments, please specify only 1\n\n" )
85 sys.stdout.write(__doc__)
87 elif not os.path.exists(filename[0]):
88 sys.stderr.write(
"\nERROR: xdaq XML config file does not exist please verify\n\n" )
89 sys.stdout.write(__doc__)
94 grid.insert(0,[
"Application",
"Server",
"Port",
"PID",
"LogfileName",
"App Config File"])
99 newrecord=[record[0],record[3],record[4]]
103 grid.insert(0,[
"Application",
"PID",
"LogfileName"])
108 newrecord=[record[0],record[3],record[4]]
113 appinf.printGrid(grid)