当前位置: 首页>>代码示例>>Python>>正文


Python DB.DB类代码示例

本文整理汇总了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 = {}
开发者ID:graciani,项目名称:DIRAC,代码行数:25,代码来源:FileCatalogDB.py

示例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
开发者ID:kfox1111,项目名称:DIRAC,代码行数:7,代码来源:SandboxMetadataDB.py

示例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']
开发者ID:caitriana,项目名称:DIRAC,代码行数:7,代码来源:StorageManagementDB.py

示例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']
开发者ID:DIRACGrid-test,项目名称:DIRAC,代码行数:26,代码来源:DataIntegrityDB.py

示例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'] )
开发者ID:JanEbbing,项目名称:DIRAC,代码行数:7,代码来源:SystemLoggingDB.py

示例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) 
开发者ID:KrzysztofCiba,项目名称:DIRAC,代码行数:26,代码来源:ResourceManagementDB.py

示例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)
开发者ID:LCDgit,项目名称:ILCDIRAC,代码行数:26,代码来源:OverlayDB.py

示例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
开发者ID:KrzysztofCiba,项目名称:DIRAC,代码行数:7,代码来源:SandboxMetadataDB.py

示例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"]
开发者ID:sposs,项目名称:GlastDIRAC,代码行数:26,代码来源:GlastAdditionalInfoDB.py

示例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 )
开发者ID:IgorPelevanyuk,项目名称:DIRAC,代码行数:7,代码来源:RequestDB.py

示例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
开发者ID:sbel,项目名称:bes3-jinr,代码行数:8,代码来源:DataLoggingDB.py

示例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' ] )
开发者ID:acasajus,项目名称:VMDIRAC,代码行数:8,代码来源:VirtualMachineDB.py

示例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"])
开发者ID:kfox1111,项目名称:DIRAC,代码行数:9,代码来源:UserProfileDB.py

示例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' ] )
开发者ID:DIRACGrid,项目名称:DIRAC,代码行数:9,代码来源:UserProfileDB.py

示例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' ] )
开发者ID:vfalbor,项目名称:BigDataDIRAC,代码行数:9,代码来源:BigDataDB.py


注:本文中的DIRAC.Core.Base.DB.DB类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。