updateRunHistoryTables.py
Go to the documentation of this file.
1 import sys
2 import os
3 import psycopg2
4 
5 det=sys.argv[1]
6 part=sys.argv[2]
7 minrun=sys.argv[3]
8 
9 if det == 'FarDet':
10  try:
11  conn = psycopg2.connect("dbname=nova_prod host=novadaq-far-db-03.fnal.gov user=novadaq port=5432")
12  except:
13  print "I am unable to connect to the database"
14  exit(0)
15 elif det == 'NearDet':
16  try:
17  conn = psycopg2.connect("dbname=nova_prod host=novadaq-near-db-01.fnal.gov user=novadaq port=5432")
18  except:
19  print "I am unable to connect to the database"
20  exit(0)
21 
22 cur = conn.cursor()
23 
24 SQL = "select run from {}.runs where run>{} and tstop is NULL and partition={} and tstart<'yesterday' order by run desc".format(det,minrun,part)
25 
26 cur.execute(SQL)
27 
28 rows = cur.fetchall()
29 
30 for row in rows:
31  run = row[0]
32  cmd = "updateRunHistoryTables -d {} {}".format(det,run)
33 # cmd = "updateRunHistoryTables {} {}".format(det,run)
34  print cmd
35  os.system(cmd)
36 
std::string format(const int32_t &value, const int &ndigits=8)
Definition: HexUtils.cpp:14
exit(0)