runsumdbquery.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 from __future__ import print_function
4 
5 import sys
6 import os
7 import psycopg2
8 import string
9 #import re
10 
11 if (len(sys.argv) != 2):
12  print ("Usage: getDUNE35tRunInfo.py [run number]")
13  exit(1)
14 
15 run=sys.argv[1]
16 
17 try:
18  conn = psycopg2.connect("dbname=lbne35t_prod host=ifdbrep.fnal.gov port=5440 user=lbne_reader password=dune35t")
19 except:
20  print ("I am unable to connect to the database")
21  exit(0)
22 
23 cur = conn.cursor()
24 
25 SQL = "select * from dune35t.run_summary where run="+run
26 
27 cur.execute(SQL)
28 row = cur.fetchone()
29 
30 run = row[0]
31 cfg = row[1]
32 runType = row[2]
33 comp = row[3]
34 tstart = row[4]
35 tstop = row[5]
36 # sometimes we get None as the stop time -- put in the start time
37 #tstop = str(tstop).replace("None",str(tstart))
38 
39 print ("Run: ",run)
40 print ("ConfigId: ",cfg)
41 print ("Run Type: ",runType)
42 print ("Components: ",comp)
43 print ("Start time: ",tstart)
44 print ("Stop time: ",tstop)