本文整理汇总了Python中DIRAC.ResourceStatusSystem.Utilities.CSHelpers.getSEProtocolOption方法的典型用法代码示例。如果您正苦于以下问题:Python CSHelpers.getSEProtocolOption方法的具体用法?Python CSHelpers.getSEProtocolOption怎么用?Python CSHelpers.getSEProtocolOption使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DIRAC.ResourceStatusSystem.Utilities.CSHelpers
的用法示例。
在下文中一共展示了CSHelpers.getSEProtocolOption方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: export_getCachedDowntimes
# 需要导入模块: from DIRAC.ResourceStatusSystem.Utilities import CSHelpers [as 别名]
# 或者: from DIRAC.ResourceStatusSystem.Utilities.CSHelpers import getSEProtocolOption [as 别名]
def export_getCachedDowntimes( self, element, elementType, elementName, severity, startDate, endDate ):
if elementType == 'StorageElement':
result = CSHelpers.getSEProtocolOption( elementName, 'Host' )
if not result['OK']:
return S_ERROR( 'StorageElement %s host not found' % elementName )
name = result['Value']
if startDate > endDate:
return S_ERROR( 'startDate > endDate' )
res = rmClient.selectDowntimeCache( element = element, name = name, severity = severity,
meta = { 'columns' : [ 'Element', 'Name', 'StartDate',
'EndDate', 'Severity',
'Description', 'Link' ] } )
if not res[ 'OK' ]:
return res
downtimes = []
for dt in res[ 'Value' ]:
dtDict = dict( zip( res[ 'Columns' ], dt ) )
if dtDict[ 'StartDate' ] < endDate and dtDict[ 'EndDate' ] > startDate:
downtimes.append( dt )
result = S_OK( downtimes )
result[ 'Columns' ] = res[ 'Columns' ]
return result
#...............................................................................
#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF
示例2: export_getDowntimes
# 需要导入模块: from DIRAC.ResourceStatusSystem.Utilities import CSHelpers [as 别名]
# 或者: from DIRAC.ResourceStatusSystem.Utilities.CSHelpers import getSEProtocolOption [as 别名]
def export_getDowntimes( self, element, elementType, elementName ):
if elementType == 'StorageElement':
result = CSHelpers.getSEProtocolOption( elementName, 'Host' )
if not result['OK']:
return S_ERROR( 'StorageElement %s host not found' % elementName )
name = result['Value']
return rmClient.selectDowntimeCache( element = element, name = name,
meta = { 'columns' : [ 'StartDate', 'EndDate',
'Link', 'Description',
'Severity' ] } )
示例3: _prepareCommand
# 需要导入模块: from DIRAC.ResourceStatusSystem.Utilities import CSHelpers [as 别名]
# 或者: from DIRAC.ResourceStatusSystem.Utilities.CSHelpers import getSEProtocolOption [as 别名]
def _prepareCommand( self ):
'''
DowntimeCommand requires three arguments:
- name : <str>
- element : Site / Resource
- elementType: <str>
If the elements are Site(s), we need to get their GOCDB names. They may
not have, so we ignore them if they do not have.
'''
if 'name' not in self.args:
return S_ERROR( '"name" not found in self.args' )
elementName = self.args[ 'name' ]
if 'element' not in self.args:
return S_ERROR( '"element" not found in self.args' )
element = self.args[ 'element' ]
if 'elementType' not in self.args:
return S_ERROR( '"elementType" not found in self.args' )
elementType = self.args[ 'elementType' ]
if not element in [ 'Site', 'Resource' ]:
return S_ERROR( 'element is not Site nor Resource' )
hours = None
if 'hours' in self.args:
hours = self.args[ 'hours' ]
# Transform DIRAC site names into GOCDB topics
if element == 'Site':
gocSite = getGOCSiteName( elementName )
if not gocSite[ 'OK' ]:
return gocSite
elementName = gocSite[ 'Value' ]
# The DIRAC se names mean nothing on the grid, but their hosts do mean.
elif elementType == 'StorageElement':
result = CSHelpers.getSEProtocolOption( elementName, 'Host' )
if not result['OK']:
return S_ERROR( 'No seHost for %s' % elementName )
elementName = result['Value']
return S_OK( ( element, elementName, hours ) )
示例4: _prepareCommand
# 需要导入模块: from DIRAC.ResourceStatusSystem.Utilities import CSHelpers [as 别名]
# 或者: from DIRAC.ResourceStatusSystem.Utilities.CSHelpers import getSEProtocolOption [as 别名]
def _prepareCommand( self ):
'''
SpaceTokenOccupancy requires one argument:
- elementName : <str>
Given a (storage)elementName, we calculate its endpoint and spaceToken,
which are used to query the srm interface.
'''
if not 'name' in self.args:
return S_ERROR( '"name" not found in self.args' )
elementName = self.args[ 'name' ]
endpoint = CSHelpers.getStorageElementEndpoint( elementName )
if not endpoint[ 'OK' ]:
return endpoint
endpoint = endpoint[ 'Value' ]
spaceToken = CSHelpers.getSEProtocolOption( elementName, 'SpaceToken' )
if not spaceToken[ 'OK' ]:
return spaceToken
spaceToken = spaceToken[ 'Value']
return S_OK( ( endpoint, spaceToken ) )