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


Python ReportsClient.generatePlot方法代码示例

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


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

示例1: __getPlotSrc

# 需要导入模块: from DIRAC.AccountingSystem.Client.ReportsClient import ReportsClient [as 别名]
# 或者: from DIRAC.AccountingSystem.Client.ReportsClient.ReportsClient import generatePlot [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

示例2: __getPlotSrc

# 需要导入模块: from DIRAC.AccountingSystem.Client.ReportsClient import ReportsClient [as 别名]
# 或者: from DIRAC.AccountingSystem.Client.ReportsClient.ReportsClient import generatePlot [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.generatePlot方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。