Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • atlas-tdaq-software/CastorScript
1 result
Show changes
Commits on Source (3)
Showing with 49 additions and 33 deletions
import cx_Oracle
import coral_auth
import oracledb
oracledb.init_oracle_client()
user, pwd, dbn = coral_auth.get_connection_parameters_from_connection_string(
'oracle://int8r/ATLAS_SFO_T0')
orcl = cx_Oracle.connect(user, pwd, dbn)
orcl = oracledb.connect(user=user, password=pwd, dsn=dbn)
curs = orcl.cursor()
try:
......
......@@ -4,7 +4,7 @@ from __future__ import print_function
from future import standard_library
standard_library.install_aliases()
from builtins import str
import urllib.request, urllib.error, urllib.parse #pylint: disable=import-error
import urllib.request, urllib.error, urllib.parse
import json
import uuid
from time import time
......
......@@ -7,7 +7,7 @@ standard_library.install_aliases()
from builtins import str
from builtins import range
from past.utils import old_div
import urllib.request, urllib.error, urllib.parse #pylint: disable=import-error
import urllib.request, urllib.error, urllib.parse
import json
import uuid
from time import time
......
......@@ -15,10 +15,11 @@ else
fi
python -i -c "
import cx_Oracle
import coral_auth
import oracledb
oracledb.init_oracle_client()
user,pwd,dbn = coral_auth.get_connection_parameters_from_connection_string('oracle://int8r/ATLAS_SFO_T0')
orcl = cx_Oracle.connect(user, pwd, dbn)
orcl = oracledb.connect(user=user, password=pwd, dsn=dbn)
curs = orcl.cursor()
print('orcl: connection to db object, curs: cursor on the connection')
"
#!/usr/bin/env bash
DBN=atonr_conf
if [ "x$CMTRELEASE" != x ]; then
# TDAQ environment already loaded
echo "using $CMTRELEASE"
......@@ -8,17 +10,19 @@ elif [ -r /sw/castor/script_setup.sh ]; then
source /sw/castor/script_setup.sh
elif [ -r /cvmfs/atlas.cern.ch/repo/sw/tdaq/tools/cmake_tdaq/bin/cm_setup.sh ]; then
#testbed
source /cvmfs/atlas.cern.ch/repo/sw/tdaq/tools/cmake_tdaq/bin/cm_setup.sh
source /cvmfs/atlas.cern.ch/repo/sw/tdaq/tools/cmake_tdaq/bin/cm_setup.sh tdaq-11-02-00
DBN=atonr_adg
else
echo "error: cannot setup environment"
exit
fi
python -i -c "
import cx_Oracle
import coral_auth
user,pwd,dbn = coral_auth.get_connection_parameters_from_connection_string('oracle://atonr_conf/ATLAS_SFO_T0_R')
orcl = cx_Oracle.connect(user, pwd, dbn)
import oracledb
oracledb.init_oracle_client()
user,pwd,dbn = coral_auth.get_connection_parameters_from_connection_string('oracle://${DBN}/ATLAS_SFO_T0_R')
orcl = oracledb.connect(user=user, password=pwd, dsn=dbn)
curs = orcl.cursor()
print('orcl: connection to db object, curs: cursor on the connection')
"
#!/usr/bin/env bash
DBN=atonr_conf
if [ "x$CMTRELEASE" != x ]; then
# TDAQ environment already loaded
echo "using $CMTRELEASE"
......@@ -9,16 +11,18 @@ elif [ -r /sw/castor/script_setup.sh ]; then
elif [ -r /cvmfs/atlas.cern.ch/repo/sw/tdaq/tools/cmake_tdaq/bin/cm_setup.sh ]; then
#testbed
source /cvmfs/atlas.cern.ch/repo/sw/tdaq/tools/cmake_tdaq/bin/cm_setup.sh
DBN=atonr_adg
else
echo "error: cannot setup environment"
exit
fi
python -i -c "
import cx_Oracle
import coral_auth
user,pwd,dbn = coral_auth.get_connection_parameters_from_connection_string('oracle://atonr_conf/ATLAS_SFO_T0')
orcl = cx_Oracle.connect(user, pwd, dbn)
import oracledb
oracledb.init_oracle_client()
user,pwd,dbn = coral_auth.get_connection_parameters_from_connection_string('oracle://${DBN}/ATLAS_SFO_T0')
orcl = oracledb.connect(user=user, password=pwd, dsn=dbn)
curs = orcl.cursor()
print('orcl: connection to db object, curs: cursor on the connection')
"
#!/usr/bin/env python
import cx_Oracle
import sqlite3
import coral_auth
import argparse
import datetime
import oracledb
oracledb.init_oracle_client()
def get_next_index(orac, seqname):
......@@ -236,7 +237,7 @@ def oracle_create_missing_and_close_opened(oradb_url, sqlite_file,
try:
user, pwd, dbn = coral_auth.get_connection_parameters_from_connection_string(
oradb_url)
oradb = cx_Oracle.connect(user, pwd, dbn)
oradb = oracledb.connect(user=user, password=pwd, dsn=dbn)
orac = oradb.cursor()
except Exception:
print(f'error connecing to {oradb_url}')
......
#!/usr/bin/env python
import cx_Oracle
import coral_auth
import argparse
import oracledb
oracledb.init_oracle_client()
def _stream_status_fast(orac, run_number, sfoids):
......@@ -76,7 +77,7 @@ def oracle_run_status_fast(oradb_url, run_number, sfos):
print('run status:')
user, pwd, dbn = coral_auth.get_connection_parameters_from_connection_string(
oradb_url)
oradb = cx_Oracle.connect(user, pwd, dbn)
oradb = oracledb.connect(user=user, password=pwd, dsn=dbn)
orac = oradb.cursor()
sfoids = [f'SFO-{i}' for i in sfos]
......@@ -92,7 +93,7 @@ def oracle_run_status_report(oradb_url, run_number, sfos, report):
print('run status:')
user, pwd, dbn = coral_auth.get_connection_parameters_from_connection_string(
oradb_url)
oradb = cx_Oracle.connect(user, pwd, dbn)
oradb = oracledb.connect(user=user, password=pwd, dsn=dbn)
orac = oradb.cursor()
sfoids = [f'SFO-{i}' for i in sfos]
......
#!/bin/env python
import threading
import urllib.request, urllib.error, urllib.parse #pylint: disable=import-error
import urllib.request, urllib.error, urllib.parse
import json
import queue
import time
......
......@@ -47,7 +47,7 @@ class InfoServiceThread(threading.Thread):
if self.ipc_partition.isValid():
self.logger.info('partition %s is valid: IS publication enabled',
self.ipc_partition.name())
# variable to handle the period between the partition becomes valid
# and the first publication attempt
# None means that there is nothing to do
......@@ -211,7 +211,7 @@ class InfoServiceThread(threading.Thread):
stats.write_count, stats.read_bytes, stats.write_bytes,
stats.busy_time)
return
d = psutil.disk_io_counters(perdisk=True, nowrap=True)
for sd in d:
if not sd in self.conf.ISStorageIoStatsDevices:
......
#!/bin/env python
import cx_Oracle
import sys
import datetime
import time
import coral_auth
import oracledb
oracledb.init_oracle_client()
# Errors for Oracle Database
# StandardError:
......@@ -22,8 +23,8 @@ class OraDB(object):
def __init__(self, url):
self.connstring = url
self.conn_params = coral_auth.get_connection_parameters_from_connection_string(self.connstring) #pylint: disable=no-member
self.orcl = cx_Oracle.connect(*self.conn_params) #pylint: disable=no-member
self.conn_user, self.conn_pwd, self.conn_dbn = coral_auth.get_connection_parameters_from_connection_string(self.connstring)
self.orcl = oracledb.connect(user=self.conn_user, password=self.conn_pwd, dsn=self.conn_dbn)
self.curs = self.orcl.cursor()
self.lastKeys = {}
......@@ -37,7 +38,7 @@ class OraDB(object):
return self.curs.fetchone()
def getDateVar(self):
return self.curs.var(cx_Oracle.DATETIME) #pylint: disable=no-member
return self.curs.var(oracledb.DATETIME)
def lastOp(self):
return self.curs.statement
......@@ -48,7 +49,7 @@ class OraDB(object):
def refresh(self):
self.orcl.commit()
self.orcl.close()
self.orcl = cx_Oracle.connect(*self.conn_params) #pylint: disable=no-member
self.orcl = oracledb.connect(user=self.conn_user, password=self.conn_pwd, dsn=self.conn_dbn)
self.curs = self.orcl.cursor()
class Database():
......@@ -84,7 +85,7 @@ class Database():
return (True, True)
else:
return (True, False)
except (cx_Oracle.InterfaceError,cx_Oracle.DatabaseError) as ex: #pylint: disable=no-member
except (oracledb.InterfaceError,oracledb.DatabaseError) as ex:
errstr = 'database error: {}, request: "{}", request keys:"{}"'.format(
str(ex), str(self.db.lastOp()), str(self.db.getLastKeys()))
self.logger.error(errstr)
......@@ -112,7 +113,7 @@ class Database():
# cannot find the file in the DB
return (None, None, None)
result = row[:3]
except (cx_Oracle.InterfaceError,cx_Oracle.DatabaseError) as ex: #pylint: disable=no-member
except (oracledb.InterfaceError,oracledb.DatabaseError) as ex:
errstr = 'database error: {}, request: "{}", request keys:"{}"'.format(
str(ex), str(self.db.lastOp()), str(self.db.getLastKeys()))
self.logger.error(errstr)
......@@ -127,7 +128,7 @@ class Database():
try:
self.filedeletion(sfofile)
return True
except (cx_Oracle.InterfaceError,cx_Oracle.DatabaseError) as ex: #pylint: disable=no-member
except (oracledb.InterfaceError,oracledb.DatabaseError) as ex:
errstr = 'database error: {}, request: "{}", request keys:"{}"'.format(
str(ex), str(self.db.lastOp()), str(self.db.getLastKeys()))
self.logger.error(errstr)
......@@ -145,7 +146,7 @@ class Database():
retry = False
try:
self.filetransfer(sfofile, remotefile)
except (cx_Oracle.InterfaceError, cx_Oracle.DatabaseError) as ex: #pylint: disable=no-member
except (oracledb.InterfaceError, oracledb.DatabaseError) as ex:
ex_info = str(ex)
errstr = 'database error: {}, request: "{}", request keys:"{}"'.format(
str(ex), str(self.db.lastOp()), str(self.db.getLastKeys()))
......@@ -177,7 +178,7 @@ class Database():
return True
except (cx_Oracle.InterfaceError, cx_Oracle.DatabaseError) as ex: #pylint: disable=no-member
except (oracledb.InterfaceError, oracledb.DatabaseError) as ex:
errstr = 'database error: {}, request: "{}", request keys:"{}"'.format(
str(ex), str(self.db.lastOp()), str(self.db.getLastKeys()))
self.logger.error(errstr)
......@@ -205,7 +206,7 @@ class Database():
try:
self.db.execute(args,keys)
return True
except (cx_Oracle.InterfaceError,cx_Oracle.DatabaseError) as ex: #pylint: disable=no-member
except (oracledb.InterfaceError,oracledb.DatabaseError) as ex:
errstr = 'database error: {}, request: "{}", request keys:"{}"'.format(
str(ex), str(self.db.lastOp()), str(self.db.getLastKeys())
)
......
......@@ -2,7 +2,10 @@
TDAQ_RELEASE=tdaq-11-02-00
echo "setting up environment for centos, tdaq release: $TDAQ_RELEASE"
source /sw/tdaq/setup/setup_$TDAQ_RELEASE.sh
if ! source /sw/tdaq/setup/setup_$TDAQ_RELEASE.sh; then
echo "error: could not source TDAQ release $TDAQ_RELEASE"
return 1
fi
# take the latest version of XROOTD available for this TDAQ release
XROOTD_VERSION=`ls $LCG_INST_PATH/$TDAQ_LCG_RELEASE/xrootd/ | \
......