7 print "Cannot import cx_Oracle:", e
10 DATABASE =
"cms_orcoff_prep"
11 USERNAME =
"CMS_COND_REGRESSION"
13 AUTH_PATH =
"/afs/cern.ch/cms/DB/conddb/test/authentication.xml"
17 pattern = re.compile(
r'value="([^"]+)')
18 matching = pattern.search(login)
24 pfile = open(auth,
"r")
25 plist = pfile.readlines()
26 for i
in range (0, len(plist)):
27 if string.find(plist[i],
'<connection name="'+connStr+
'">') != -1:
33 conn_string = str(USERNAME+
"/"+PASSWORD+
"@"+DATABASE)
34 conn = cx_Oracle.connect(conn_string)
38 os.environ[
'TNS_ADMIN'] =
"/afs/cern.ch/project/oracle/admin"
39 coralConnStr =
"oracle://"+DATABASE+
"/"+USERNAME+
""
40 PASSWORD =
getLogin(AUTH_PATH, coralConnStr)
41 return (coralConnStr,USERNAME,PASSWORD,AUTH_PATH)
48 curs = self.conn.cursor()
49 sqlstr =
"SELECT RID, TO_CHAR(RDATE, 'DD.MM.YYYY HH24:MI:SS'), LABEL, T_RELEASE, T_ARCH "
50 sqlstr +=
"FROM RUN_HEADER WHERE LABEL = :labl ORDER BY RID DESC"
52 curs.execute(sqlstr, labl = label)
53 result = curs.fetchall()
57 curs = self.conn.cursor()
58 sqlstr =
"SELECT DISTINCT LABEL FROM RUN_HEADER"
64 curs = self.conn.cursor()
65 sqlstr =
"SELECT ID, R_RELEASE, R_ARCH FROM RUN_RESULT WHERE RID = :ids ORDER BY R_RELEASE"
67 curs.execute(sqlstr, ids=rid)
68 result = curs.fetchall()
72 curs = self.conn.cursor()
73 sqlstr =
"SELECT ID, STATUS, STEP_LABEL FROM RUN_STEP_RESULT WHERE ID= :ids"
75 curs.execute(sqlstr, ids=id)
76 result = curs.fetchall()
81 curs = self.conn.cursor()
82 if(release !=
"" and arch !=
""):
83 sqlstr =
"SELECT RID, TO_CHAR(RDATE, 'DD.MM.YYYY HH24:MI:SS'), LABEL, T_RELEASE, T_ARCH FROM RUN_HEADER WHERE T_RELEASE = :rel AND T_ARCH = :arc AND LABEL = :labl ORDER BY RID DESC"
85 curs.execute(sqlstr, rel=release, arc=arch, labl=label)
87 sqlstr =
"SELECT RID, TO_CHAR(RDATE, 'DD.MM.YYYY HH24:MI:SS'), LABEL, T_RELEASE, T_ARCH FROM RUN_HEADER WHERE T_RELEASE = :rel AND LABEL = :labl ORDER BY RID DESC"
89 curs.execute(sqlstr, rel=release, labl=label)
91 sqlstr =
"SELECT RID, TO_CHAR(RDATE, 'DD.MM.YYYY HH24:MI:SS'), LABEL, T_RELEASE, T_ARCH FROM RUN_HEADER WHERE T_ARCH = :arc AND LABEL = :labl ORDER BY RID DESC"
93 curs.execute(sqlstr, arc=arch, labl=label)
94 result = curs.fetchall()
98 curs = self.conn.cursor()
99 sqlstr =
"SELECT LOG FROM RUN_HEADER WHERE RID = :rid"
101 curs.execute(sqlstr, rid = runID)
108 stat = resDb.runResults( rid )
115 resList = resDb.stepResults( runID )
122 webLabels = resDb.labels()
129 relHeaders = resDb.releasesHeaders( label, release, arch)
136 statusHeaders = resDb.resultHeaders( label )
143 logStatus = resDb.readLogStatus( label, runId )
def getDBConnectionParams