コード例 #1
0
if not params.has_key( 't' ):
  params[ 't' ] = None

if not params.has_key( 'r' ):
  params[ 'r' ] = 'Status set by %s' % userName
  
if not params.has_key( 'u' ):
  params[ 'u' ] = DEFAULT_DURATION  
else:
  if not isintance( params[ 'u' ], int ):
    gLogger.error( 'Expecting integer for duration, got "%s"' % params[ 'u' ])
    DIRAC.exit( 2 )  


rsCl = ResourceStatusClient()
element = rsCl.getElementStatus( params[ 'g' ], elementName = params[ 'n' ], 
                                 statusType = params[ 't' ], meta = { 'columns' : [ 'StatusType', 'TokenOwner', 'TokenExpiration' ]} )

if not element['OK']:
  gLogger.error( 'Error trying to get (%s,%s,%s)' % ( params['g'], params['n'], params['t']) )
  DIRAC.exit( 2 )  
  
if not element[ 'Value' ]:
  gLogger.notice( 'Not found any record for this element (%s,%s,%s)' % ( params['g'], params['n'], params['t']) )  
  DIRAC.exit( 0 )

from datetime import datetime, timedelta

for lst in element[ 'Value' ]:
    
  sType = lst[0]
  tOwn  = lst[1]   
コード例 #2
0
    gLogger.error('"%s" is not a valid granularity' % params['g'])
    DIRAC.exit(2)

if not params['a'] in ValidStatus:
    gLogger.error('"%s" is not a valid status' % params['a'])
    DIRAC.exit(2)

if not params.has_key('t'):
    params['t'] = None

if not params.has_key('r'):
    params['r'] = 'Status forced by %s' % userName

rsCl = ResourceStatusClient()
element = rsCl.getElementStatus(params['g'],
                                elementName=params['n'],
                                statusType=params['t'],
                                meta={'columns': ['Status', 'StatusType']})

if not element['OK']:
    gLogger.error('Error trying to get (%s,%s,%s)' %
                  (params['g'], params['n'], params['t']))
    DIRAC.exit(2)

if not element['Value']:
    gLogger.notice('Not found any record for this element (%s,%s,%s)' %
                   (params['g'], params['n'], params['t']))
    DIRAC.exit(0)

from datetime import datetime, timedelta

_tomorrow = datetime.utcnow().replace(microsecond=0) + timedelta(days=1)
コード例 #3
0
ファイル: dirac-rss-set-status.py プロジェクト: bmb/DIRAC
if not params[ 'g' ] in validElements:
  gLogger.error( '"%s" is not a valid granularity' % params[ 'g' ] )
  DIRAC.exit( 2 )

if not params[ 'a' ] in ValidStatus:
  gLogger.error( '"%s" is not a valid status' % params[ 'a' ] )
  DIRAC.exit( 2 )

if not params.has_key( 't' ):
  params[ 't' ] = None

if not params.has_key( 'r' ):
  params[ 'r' ] = 'Status forced by %s' % userName
  
rsCl = ResourceStatusClient()
element = rsCl.getElementStatus( params[ 'g' ], elementName = params[ 'n' ], 
                                 statusType = params[ 't' ], meta = { 'columns' : [ 'Status', 'StatusType' ]} )

if not element['OK']:
  gLogger.error( 'Error trying to get (%s,%s,%s)' % ( params['g'], params['n'], params['t']) )
  DIRAC.exit( 2 )  
  
if not element[ 'Value' ]:
  gLogger.notice( 'Not found any record for this element (%s,%s,%s)' % ( params['g'], params['n'], params['t']) )  
  DIRAC.exit( 0 )

from datetime import datetime, timedelta

_tomorrow = datetime.utcnow().replace( microsecond = 0 ) + timedelta( days = 1 )

for lst in element[ 'Value' ]: