Exemplo n.º 1
0
def getWMSClient():
  return WMSClient( getRPCClient( "WorkloadManagement/JobManager" ),
                    getRPCClient( "WorkloadManagement/SandboxStore" ),
                    getTransferClient( "WorkloadManagement/SandboxStore" ) )
Exemplo n.º 2
0
def getJobsHistory():
  result = gOAManager.authorize()
  if not result[ 'OK' ]:
    bottle.abort( 401, result[ 'Message' ] )
  condDict = {}
  if 'allOwners' not in bottle.request.params:
    condDict[ 'User' ] = gOAData.userName
  timeSpan = 86400
  if 'timeSpan' in bottle.request.params:
    try:
      timeSpan = max( 86400, int( bottle.request.params[ 'timeSpan' ] ) )
    except ValueError:
      bottle.abort( 400, "timeSpan has to be an integer!" )
  print "[DEBUG] condDict is %s" % condDict
  rpg = ReportsClient( rpcClient = getRPCClient("Accounting/ReportGenerator"), transferClient = getTransferClient("Accounting/ReportGenerator") )
  end = datetime.datetime.utcnow()
  start = end - datetime.timedelta( seconds = timeSpan )
  result = rpg.getReport( "WMSHistory", "NumberOfJobs", start, end, condDict, 'Status' )
  if not result[ 'OK' ]:
    bottle.abort( 500, "Server Error: %s" % result[ 'Message' ] )
  return result[ 'Value' ]