本文整理汇总了Python中DIRAC.Core.Base.DB.DB类的典型用法代码示例。如果您正苦于以下问题:Python DB类的具体用法?Python DB怎么用?Python DB使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DB类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__( self, databaseLocation='DataManagement/FileCatalogDB', maxQueueSize=10 ):
""" Standard Constructor
"""
# The database location can be specified in System/Database form or in just the Database name
# in the DataManagement system
db = databaseLocation
if db.find('/') == -1:
db = 'DataManagement/' + db
DB.__init__(self,'FileCatalogDB',db,maxQueueSize)
result = self._createTables( self.__tables )
if not result['OK']:
gLogger.error( "Failed to create tables", str( self.__tables.keys() ) )
elif result['Value']:
gLogger.info( "Tables created: %s" % ','.join( result['Value'] ) )
self.ugManager = None
self.seManager = None
self.securityManager = None
self.dtree = None
self.fileManager = None
self.dmeta = None
self.fmeta = None
self.statusDict = {}
示例2: __init__
def __init__( self ):
DB.__init__( self, 'SandboxMetadataDB', 'WorkloadManagement/SandboxMetadataDB' )
result = self.__initializeDB()
if not result[ 'OK' ]:
raise RuntimeError( "Can't create tables: %s" % result[ 'Message' ] )
self.__assignedSBGraceDays = 0
self.__unassignedSBGraceDays = 15
示例3: __init__
def __init__( self, systemInstance = 'Default', maxQueueSize = 10 ):
DB.__init__( self, 'StorageManagementDB', 'StorageManagement/StorageManagementDB', maxQueueSize )
self.lock = threading.Lock()
self.TASKPARAMS = ['TaskID', 'Status', 'Source', 'SubmitTime', 'LastUpdate', 'CompleteTime', 'CallBackMethod', 'SourceTaskID']
self.REPLICAPARAMS = ['ReplicaID', 'Type', 'Status', 'SE', 'LFN', 'PFN', 'Size', 'FileChecksum', 'GUID', 'SubmitTime', 'LastUpdate', 'Reason', 'Links']
self.STAGEPARAMS = ['ReplicaID', 'StageStatus', 'RequestID', 'StageRequestSubmitTime', 'StageRequestCompletedTime', 'PinLength', 'PinExpiryTime']
self.STATES = ['Failed', 'New', 'Waiting', 'Offline', 'StageSubmitted', 'Staged']
示例4: __init__
def __init__( self ):
""" Standard Constructor
"""
DB.__init__( self, 'DataIntegrityDB', 'DataManagement/DataIntegrityDB' )
self.tableName = 'Problematics'
self.tableDict = { self.tableName: { 'Fields' : { 'FileID': 'INTEGER NOT NULL AUTO_INCREMENT',
'Prognosis': 'VARCHAR(32) NOT NULL',
'LFN': 'VARCHAR(255) NOT NULL',
'PFN': 'VARCHAR(255)',
'Size': 'BIGINT(20)',
'SE': 'VARCHAR(32)',
'GUID': 'VARCHAR(255)',
'Status': 'VARCHAR(32) DEFAULT "New"',
'Retries': 'INTEGER DEFAULT 0',
'InsertDate': 'DATETIME NOT NULL',
'LastUpdate': 'DATETIME NOT NULL',
'Source': 'VARCHAR(127) NOT NULL DEFAULT "Unknown"',
},
'PrimaryKey': 'FileID',
'Indexes': { 'PS': ['Prognosis', 'Status']},
'Engine': 'InnoDB',
}
}
self.fieldList = ['FileID', 'LFN', 'PFN', 'Size', 'SE', 'GUID', 'Prognosis']
示例5: __init__
def __init__( self ):
""" Standard Constructor
"""
DB.__init__( self, 'SystemLoggingDB', 'Framework/SystemLoggingDB', debug = DEBUG )
result = self._checkTable()
if not result['OK']:
gLogger.error( 'Failed to check/create the database tables', result['Message'] )
示例6: __init__
def __init__(self, *args, **kwargs):
if len(args) == 1:
if isinstance(args[0], str):
# systemInstance=args[0]
maxQueueSize=10
if isinstance(args[0], int):
maxQueueSize=args[0]
# systemInstance='Default'
elif len(args) == 2:
# systemInstance=args[0]
maxQueueSize=args[1]
elif len(args) == 0:
# systemInstance='Default'
maxQueueSize=10
if 'DBin' in kwargs.keys():
DBin = kwargs['DBin']
if isinstance(DBin, list):
from DIRAC.Core.Utilities.MySQL import MySQL
self.db = MySQL('localhost', DBin[0], DBin[1], 'ResourceManagementDB')
else:
self.db = DBin
else:
from DIRAC.Core.Base.DB import DB
self.db = DB('ResourceManagementDB','ResourceStatus/ResourceManagementDB',maxQueueSize)
示例7: __init__
def __init__( self, maxQueueSize = 10 ):
"""
"""
self.ops = Operations()
self.dbname = 'OverlayDB'
self.logger = gLogger.getSubLogger('OverlayDB')
DB.__init__( self, self.dbname, 'Overlay/OverlayDB', maxQueueSize )
self._createTables( { "OverlayData" : { 'Fields' : { 'Site' : "VARCHAR(256) UNIQUE NOT NULL",
'NumberOfJobs' : "INTEGER DEFAULT 0"
},
'PrimaryKey' : 'Site',
'Indexes': {'Index':['Site']}
}
}
)
limits = self.ops.getValue("/Overlay/MaxConcurrentRunning", 200)
self.limits = {}
self.limits["default"] = limits
res = self.ops.getSections("/Overlay/Sites/")
sites = []
if res['OK']:
sites = res['Value']
for tempsite in sites:
res = self.ops.getValue("/Overlay/Sites/%s/MaxConcurrentRunning" % tempsite, 200)
self.limits[tempsite] = res
self.logger.info("Using the following restrictions : %s" % self.limits)
示例8: __init__
def __init__( self, maxQueueSize = 10 ):
DB.__init__( self, 'SandboxMetadataDB', 'WorkloadManagement/SandboxMetadataDB', maxQueueSize )
result = self.__initializeDB()
if not result[ 'OK' ]:
raise Exception( "Can't create tables: %s" % result[ 'Message' ])
self.__assignedSBGraceDays = 0
self.__unassignedSBGraceDays = 15
示例9: __init__
def __init__(self, maxQueueSize=10):
"""
"""
# self.ops = Operations()
self.dbname = "GlastAdditionalInfoDB"
self.logger = gLogger.getSubLogger("GlastAdditionalInfoDB")
DB.__init__(self, self.dbname, "ResourceStatus/GlastAdditionalInfoDB", maxQueueSize)
self.fields = ["CEName", "Status", "Software_Tag"]
self._createTables(
{
"SoftwareTags_has_Sites": {
"Fields": {
"idRelation": "INT NOT NULL AUTO_INCREMENT",
"CEName": "VARCHAR(45) NOT NULL",
"Status": "ENUM('New','Installing','Valid','Bad','Removed') DEFAULT 'New'",
"Software_Tag": "VARCHAR(255) NOT NULL",
"LastUpdateTime": "DATETIME",
},
"PrimaryKey": ["idRelation"],
"Indexes": {"Index": ["idRelation", "Software_Tag", "CEName", "Status"]},
}
}
)
self.vo = getVO("glast.org")
##tags statuses:
self.tag_statuses = ["New", "Installing", "Valid", "Bad", "Removed"]
示例10: __init__
def __init__( self, systemInstance = 'Default', maxQueueSize = 10 ):
"""c'tor
:param self: self reference
"""
self.getIdLock = threading.Lock()
DB.__init__( self, "ReqDB", "RequestManagement/ReqDB", maxQueueSize )
示例11: __init__
def __init__( self, maxQueueSize = 10 ):
""" c'tor
:param self: self reference
:param int maxQueueSize: query queue size
"""
DB.__init__( self, "DataLoggingDB", "DataManagement/DataLoggingDB", maxQueueSize )
self.gLogger = gLogger
示例12: __init__
def __init__( self, maxQueueSize = 10 ):
DB.__init__( self, 'VirtualMachineDB', 'WorkloadManagement/VirtualMachineDB', maxQueueSize )
if not self._MySQL__initialized:
raise Exception( 'Can not connect to VirtualMachineDB, exiting...' )
result = self.__initializeDB()
if not result[ 'OK' ]:
raise Exception( "Can't create tables: %s" % result[ 'Message' ] )
示例13: __init__
def __init__(self):
""" Constructor
"""
self.__permValues = ["USER", "GROUP", "VO", "ALL"]
self.__permAttrs = ["ReadAccess", "PublishAccess"]
DB.__init__(self, "UserProfileDB", "Framework/UserProfileDB", 10)
retVal = self.__initializeDB()
if not retVal["OK"]:
raise Exception("Can't create tables: %s" % retVal["Message"])
示例14: __init__
def __init__( self ):
""" Constructor
"""
self.__permValues = [ 'USER', 'GROUP', 'VO', 'ALL' ]
self.__permAttrs = [ 'ReadAccess', 'PublishAccess' ]
DB.__init__(self, 'UserProfileDB', 'Framework/UserProfileDB')
retVal = self.__initializeDB()
if not retVal[ 'OK' ]:
raise Exception( "Can't create tables: %s" % retVal[ 'Message' ] )
示例15: __init__
def __init__( self, maxQueueSize = 10 ):
DB.__init__( self, 'BigDataDB', 'WorkloadManagement/BigDataDB', maxQueueSize )
if not self._MySQL__initialized:
raise Exception( 'Can not connect to BigDataDB, exiting...' )
result = self.__initializeDB()
if not result[ 'OK' ]:
raise Exception( 'Can\'t create tables: %s' % result[ 'Message' ] )