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


Python ReportsClient.listReports方法代码示例

本文整理汇总了Python中DIRAC.AccountingSystem.Client.ReportsClient.ReportsClient.listReports方法的典型用法代码示例。如果您正苦于以下问题:Python ReportsClient.listReports方法的具体用法?Python ReportsClient.listReports怎么用?Python ReportsClient.listReports使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DIRAC.AccountingSystem.Client.ReportsClient.ReportsClient的用法示例。


在下文中一共展示了ReportsClient.listReports方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_addAndRemove

# 需要导入模块: from DIRAC.AccountingSystem.Client.ReportsClient import ReportsClient [as 别名]
# 或者: from DIRAC.AccountingSystem.Client.ReportsClient.ReportsClient import listReports [as 别名]
def test_addAndRemove():

  # just inserting one record
  record = createAccountingRecord()
  record.setStartTime()
  record.setEndTime()
  res = gDataStoreClient.addRegister(record)
  assert res['OK']
  res = gDataStoreClient.commit()
  assert res['OK']

  rc = ReportsClient()

  res = rc.listReports('DataOperation')
  assert res['OK']

  res = rc.listUniqueKeyValues('DataOperation')
  assert res['OK']

  res = rc.getReport('DataOperation', 'Successful transfers',
                     datetime.datetime.utcnow(), datetime.datetime.utcnow(),
                     {}, 'Destination')
  assert res['OK']

  # now removing that record
  res = gDataStoreClient.remove(record)
  assert res['OK']
开发者ID:DIRACGrid,项目名称:DIRAC,代码行数:29,代码来源:Test_ReportsClient.py

示例2: __showPlotPage

# 需要导入模块: from DIRAC.AccountingSystem.Client.ReportsClient import ReportsClient [as 别名]
# 或者: from DIRAC.AccountingSystem.Client.ReportsClient.ReportsClient import listReports [as 别名]
 def __showPlotPage( self, typeName, templateFile ):
   #Get unique key values
   retVal = self.__getUniqueKeyValues( typeName )
   if not retVal[ 'OK' ]:
     c.error = retVal[ 'Message' ]
     return render ( "/error.mako" )
   c.selectionValues = simplejson.dumps( retVal[ 'Value' ] )
   #Cache for plotsList?
   data = AcctController.__keysCache.get( "reportsList:%s" % typeName )
   if not data:
     repClient = ReportsClient( rpcClient = getRPCClient( "Accounting/ReportGenerator" ) )
     retVal = repClient.listReports( typeName )
     if not retVal[ 'OK' ]:
       c.error = retVal[ 'Message' ]
       return render ( "/error.mako" )
     data = simplejson.dumps( retVal[ 'Value' ] )
     AcctController.__keysCache.add( "reportsList:%s" % typeName, 300, data )
   c.plotsList = data
   return render ( templateFile )
开发者ID:atsareg,项目名称:BESDIRAC,代码行数:21,代码来源:acct.py

示例3: web_getSelectionData

# 需要导入模块: from DIRAC.AccountingSystem.Client.ReportsClient import ReportsClient [as 别名]
# 或者: from DIRAC.AccountingSystem.Client.ReportsClient.ReportsClient import listReports [as 别名]
 def web_getSelectionData(self):
   callback = {}
   typeName = self.request.arguments["type"][0]
   #Get unique key values
   retVal = self.__getUniqueKeyValues( typeName )
   if not retVal[ 'OK' ]:
     self.write(json.dumps({"success":"false", "result":"", "error":retVal[ 'Message' ]}))
     return
   callback["selectionValues"] = simplejson.dumps( retVal[ 'Value' ] )
   #Cache for plotsList?
   data = AccountingPlotHandler.__keysCache.get( "reportsList:%s" % typeName )
   if not data:
     repClient = ReportsClient( rpcClient = RPCClient( "Accounting/ReportGenerator" ) )
     retVal = repClient.listReports( typeName )
     if not retVal[ 'OK' ]:
       self.write(json.dumps({"success":"false", "result":"", "error":retVal[ 'Message' ]}))
       return
     data = simplejson.dumps( retVal[ 'Value' ] )
     AccountingPlotHandler.__keysCache.add( "reportsList:%s" % typeName, 300, data )
   callback["plotsList"] = data
   self.write(json.dumps({"success":"true", "result":callback}))
开发者ID:Kiyoshi-Hayasaka,项目名称:WebAppDIRAC,代码行数:23,代码来源:AccountingPlotHandler.py

示例4: __getPlotSrc

# 需要导入模块: from DIRAC.AccountingSystem.Client.ReportsClient import ReportsClient [as 别名]
# 或者: from DIRAC.AccountingSystem.Client.ReportsClient.ReportsClient import listReports [as 别名]
 def __getPlotSrc(self,name,time,type):
   rc = ReportsClient()
   time = str(time)
   now = datetime.datetime.utcnow()
   if  time == 'day':
     timeSpan = now - datetime.timedelta( seconds = 86400 )
   elif time == 'week':
     timeSpan = now - datetime.timedelta( seconds = 86400 * 7 )
   elif time == 'month':
     timeSpan = now - datetime.timedelta( seconds = 86400 * 30 )
   elif time == 'year':
     timeSpan = now - datetime.timedelta( seconds = 86400 * 360 )
   else:
     timeSpan = now - datetime.timedelta( seconds = 86400 * 7 )
   if len(name) < 1:
     c.result = {"success":"false","error":"Recived empty value"}
   else:
     result = rc.listReports("Job")
     if result["OK"]:
       plots = result["Value"]
       if type == 'jobsBySite':
         result = rc.generatePlot("Job",plots[8],timeSpan,now,{"Site":name},"Site")
       elif type == 'jobCPUbySite':
         result = rc.generatePlot("Job",plots[0],timeSpan,now,{"Site":name},"Site")
       elif type == 'CPUUsedBySite':
         result = rc.generatePlot("Job",plots[2],timeSpan,now,{"Site":name},"Site")
       else:
         result = rc.generatePlot("Job",plots[8],timeSpan,now,{"Site":name},"Site")
       if result["OK"]:
         result = result["Value"]
         result = result["plot"]
         gLogger.info("result:",result)
         c.result = {"success":"true","result":result}
       else:
         c.result = {"success":"false","error":result["Message"]}
     else:
       c.result = {"success":"false","error":result["Message"]}
   gLogger.info("getPlotSrc:",c.result)
   return c.result
开发者ID:DIRACGrid,项目名称:DIRACWeb,代码行数:41,代码来源:Map.py

示例5: getPlotListAndSelectionValues

# 需要导入模块: from DIRAC.AccountingSystem.Client.ReportsClient import ReportsClient [as 别名]
# 或者: from DIRAC.AccountingSystem.Client.ReportsClient.ReportsClient import listReports [as 别名]
 def getPlotListAndSelectionValues(self):
   result = {}
   try:
     typeName = str( request.params[ 'typeName' ] )
   except:
     return S_ERROR( "Missing or invalid type name!" )
   retVal = self.__getUniqueKeyValues( typeName )
   if not retVal[ 'OK' ] and 'rpcStub' in retVal:
     del( retVal[ 'rpcStub' ] )
     return retVal
   selectionValues = retVal['Value']
   data = AcctController.__keysCache.get( "reportsList:%s" % typeName )
   if not data:
     repClient = ReportsClient( rpcClient = getRPCClient( "Accounting/ReportGenerator" ) )
     retVal = repClient.listReports( typeName )
     if not retVal[ 'OK' ]:
       return retVal
     data = simplejson.dumps( retVal[ 'Value' ] )
     AcctController.__keysCache.add( "reportsList:%s" % typeName, 300, data )
   try:
     plotsList = eval(data)
   except:
     return S_ERROR('Failed to convert a string to a list!')
   return S_OK({'SelectionData':selectionValues, 'PlotList':plotsList})
开发者ID:atsareg,项目名称:BESDIRAC,代码行数:26,代码来源:acct.py

示例6: __getPlotSrc

# 需要导入模块: from DIRAC.AccountingSystem.Client.ReportsClient import ReportsClient [as 别名]
# 或者: from DIRAC.AccountingSystem.Client.ReportsClient.ReportsClient import listReports [as 别名]
 def __getPlotSrc(self,type,args,timeToSet,img):
   rc = ReportsClient()
   type = str(type)
   args = str(args)
   name = type + args
   if args == "All":
     args = {}
   else:
     args = args.split(",")
     args = {"Site":args}
   time = str(timeToSet)
   now = datetime.datetime.utcnow()
   if  timeToSet == 'day':
     timeSpan = now - datetime.timedelta( seconds = 86400 ) 
   elif timeToSet == 'week':
     timeSpan = now - datetime.timedelta( seconds = 86400 * 7 )
   elif timeToSet == 'month':
     timeSpan = now - datetime.timedelta( seconds = 86400 * 30 )
   elif timeToSet == 'year':
     timeSpan = now - datetime.timedelta( seconds = 86400 * 360 )
   else:
     timeSpan = now - datetime.timedelta( seconds = 86400 * 7 )
   if len(name) < 1:
     c.result = {"success":"false","error":"Recived empty value"}
   else:
     result = self.__imgCache.get(name)
     if not result:
       result = rc.listReports("Job")
       if result["OK"]:
         plots = result["Value"]
         if type == 'jobsBySite':
           if img == 'True':
             result = rc.generatePlot("Job",plots[8],timeSpan,now,args,"Site")
           else:
             result = rc.generatePlot("Job",plots[8],timeSpan,now,args,"Site",{'thumbnail':True,'widh':800,'height':600,'thb_width':190,'thb_height':125})
         elif type == 'jobCPUbySite':
           if img == 'True':
             result = rc.generatePlot("Job",plots[0],timeSpan,now,args,"Site")
           else:
             result = rc.generatePlot("Job",plots[0],timeSpan,now,args,"Site",{'thumbnail':True,'widh':800,'height':600,'thb_width':196,'thb_height':125})
         elif type == 'CPUUsedBySite':
           if img == 'True':
             result = rc.generatePlot("Job",plots[2],timeSpan,now,args,"Site")
           else:
             result = rc.generatePlot("Job",plots[2],timeSpan,now,args,"Site",{'thumbnail':True,'widh':800,'height':600,'thb_width':196,'thb_height':125})
         else:
           if img == 'True':
             result = rc.generatePlot("Job",plots[8],timeSpan,now,args,"Site")
           else:
             result = rc.generatePlot("Job",plots[8],timeSpan,now,{},"Site",{'thumbnail':True,'widh':800,'height':600,'thb_width':196,'thb_height':125})
         gLogger.info("-RES:",result)
         if result["OK"]:
           result = result["Value"]
           if img == 'True':
             result = result["plot"]
           else:
             result = result["thumbnail"]
           c.result = {"success":"true","result":result}
           self.__imgCache.add(name, 600, result)
         else:
           c.result = {"success":"false","error":result["Message"]}
       else:
         c.result = {"success":"false","error":result["Message"]}
     else:
       c.result = {"success":"true","result":result}
   gLogger.info("getPlotSrc:",c.result)
   return c.result
开发者ID:mirguest,项目名称:DIRACWeb,代码行数:69,代码来源:JobMonitor.py


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