16 selcmd =
"SELECT 'EVENTHISTORY_'||lpad (archive#,8,'0') from ( select archive#, start_time, end_time from atlas_pvssDCS.arc_archive A where A.group_name = 'EVENT' and (A.end_time > to_date('%s','DD-MM-YYYY HH24:MI:SS') or A.end_time is null) intersect select archive#, start_time, end_time from atlas_pvssDCS.arc_archive A where A.group_name = 'EVENT' and A.start_time < to_date('%s','DD-MM-YYYY HH24:MI:SS') )" % (iovmin, iovmax)
17 cursor.execute( selcmd )
18 eventhistory = cursor.fetchone()[0]
22 bpmvars = [
'ATLGCSLHC:BPMSW_B1_distanceIP.position.horizontal',
'ATLGCSLHC:BPMSW_B1_distanceIP.position.vertical',
23 'ATLGCSLHC:BPMSW_B2_distanceIP.position.horizontal',
'ATLGCSLHC:BPMSW_B2_distanceIP.position.vertical']
26 selcmd =
"SELECT ROUND(A.VALUE_NUMBER,8), TO_CHAR(A.TS, 'DD-MM-YYYY HH24:MI:SS:FF3') FROM ATLAS_PVSSDCS.%s A,ATLAS_PVSSDCS.ELEMENTS B WHERE A.ELEMENT_ID = B.ELEMENT_ID and ROWNUM <= 15000 AND A.ELEMENT_ID = ( SELECT ELEMENT_ID FROM ATLAS_PVSSDCS.ELEMENTS WHERE ELEMENT_NAME LIKE '%s') AND TS BETWEEN TO_DATE('%s','DD-MM-YYYY HH24:MI:SS' ) AND TO_DATE('%s','DD-MM-YYYY HH24:MI:SS' ) AND A.VALUE_NUMBER <> 'NaN' AND A.VALUE_NUMBER <> BINARY_FLOAT_INFINITY ORDER BY B.ELEMENT_NAME, A.TS" % (eventhistory, var, iovmin, iovmax)
27 cursor.execute( selcmd )
28 res[var] = cursor.fetchall()