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: 10 from __future__
import print_function
14 import ExtractAppInfoFromXML
as appinf
20 print(
"Connecting to server: "+srv+
" and fetching PID for application running on port: "+port)
21 cf=os.popen(
'ssh '+srv+
' ps -eo pid,cmd | grep '+port)
25 return "App Not Running" 31 sys.stderr.write(
"Something went really bad\n" )
37 if pid==
"App Not Running":
38 return "No active log file" 40 print(
"Connecting to server: "+srv+
" and fetching LogFile for application with PID: "+pid)
41 cf=os.popen(
'ssh '+srv+
' ls -l /tmp | grep '+pid)
45 return "App Not Running???" 55 (table,grid)=appinf.getAppInfo(filename,2,1,3,4)
63 if __name__ ==
"__main__":
67 (args,filename)=gop.getopt(sys.argv[1:],
"hf",[
"help"])
68 except getopt.GetoptError:
69 sys.stderr.write(
"Sintax Error unrecognised option" )
70 sys.stderr.write( __doc__ )
78 elif item[0]==
"--help":
79 sys.stdout.write(__doc__)
82 sys.stderr.write(
"\nERROR: xdaq XML config file name not present, please specify\n\n" )
83 sys.stdout.write(__doc__)
84 elif len(filename) > 1:
85 sys.stderr.write(
"\nERROR: Too many file names or other arguments, please specify only 1\n\n" )
86 sys.stdout.write(__doc__)
88 elif not os.path.exists(filename[0]):
89 sys.stderr.write(
"\nERROR: xdaq XML config file does not exist please verify\n\n" )
90 sys.stdout.write(__doc__)
95 grid.insert(0,[
"Application",
"Server",
"Port",
"PID",
"LogfileName",
"App Config File"])
100 newrecord=[record[0],record[3],record[4]]
104 grid.insert(0,[
"Application",
"PID",
"LogfileName"])
109 newrecord=[record[0],record[3],record[4]]
114 appinf.printGrid(grid)
S & print(S &os, JobReport::InputFile const &f)
def getAppLogFileName(srv, pid)
def getRunningAppsInfo(filename)