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


Python API.jobTrackingLoad方法代码示例

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


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

示例1: index

# 需要导入模块: import API [as 别名]
# 或者: from API import jobTrackingLoad [as 别名]
    def index(self, **rest):
        run , not_run = status()
        
        tableHeader = "<tr><th>%s</th><th>Process ID</th><th>Plots<span style=\"color:red\">*</span></th><th>CPU sensor status<span style=\"color:red\">*</span></th></tr>\n"
        plotLink = "<td><small><a href=\"%s/?Component=%s&length=12&span=hours\">last 12h</a></small></td>"
        nameNpid = "<tr><td>%s</td><td><b>%s</b></td>\n"
        sensorFound =  "sensor %s is attached to %s"
        sensorReady = "sensor %s is going to attach %s %s%s"
        sensorMissing = "<b>no CPU sensor found for %s %s...!</b>"
        
        html = """
        <html><head><style type=\"text/css\">
        th, td { text-indent:16px; text-align:left}
        th:first-child, td:first-child {text-indent:0px !important; }
        </style>
        </head>
        """
        html += "<body><h2>Components and Services State<br/>\n"
        html += "<small style=\"color:red; font-weight:normal;\">* Work in progress</small><br/></h2>\n"

        html += '<table Class="Components">\n'
#        html += "<tr><th></th><th></th><th colspan=2><small style=\"color:red;\">work in progress</th></tr>\n"
        html += tableHeader%"Components"

        for r in run:
            comp = str(r[0])
            cpid = str(r[1])
            html += nameNpid%(comp,cpid)
            html += plotLink%(self.compcpu,comp)
            html += "<td><small>"
            sensorOn, spid, cpid = API.isSensorRunning(comp)
            if sensorOn:
                html += sensorFound%(spid,cpid)
            else:
                sensorDaemonOn, spid = API.isSensorDaemonRunning(comp)
                if sensorDaemonOn:
                    html += sensorReady%(spid,"component",comp,"... retry in a minute.")
                else:
                    html += sensorMissing%("component",comp)
            html += "</small></td></tr>\n"

        for n in not_run:
            html  += nameNpid%(str(n),"Not Running")
            html += plotLink%(self.compcpu,str(n))
            html += "<td><small>"
            sensorDaemonOn, spid = API.isSensorDaemonRunning(n)
            if sensorDaemonOn:
                html += sensorReady%(spid,"component",n,"when it will be (re)started")
            else:
                html += sensorMissing%("component",n)
            html += "</small></td></tr>\n"

        html += " <tr><th>&nbsp; </th><th>&nbsp;</th></tr>\n"
        html += tableHeader%"Services"

        for serv in AllServices.keys():
            cpid = API.getPIDof(AllServices[serv])
            spid = API.isSensorRunning(AllServices[serv])
            html += nameNpid%(serv,cpid)
            html += plotLink%(self.compcpu,serv)
            html += "<td><small>"
            sensorOn, spid, cpid = API.isSensorRunning(AllServices[serv])
            if sensorOn:
                html += sensorFound%(spid,cpid)
            else:
                sensorDaemonOn, spid = API.isSensorDaemonRunning(serv)
                if sensorDaemonOn:
                    html += sensorReady%(spid,"service",serv,"... retry in a minute.")
                else:
                    html += sensorMissing%("service",serv)
            html += "</small></td></tr>\n"

        html += "<td></td><td></td>"
        html += "</table>\n"

        html += "<br/><br/> <b>Internal processing status</b><br/>"
        if isDrained() is False:
            html += "<br/> Accepting new submission: <b>YES</b><br/>"
        else:
            html += "<br/> Accepting new submission: <b>NO</b><br/>"

        outqueue = API.getOutputQueue()
        outqueuefail = API.getOutputFailedQueue()
        JTload   = API.jobTrackingLoad()
        dequeued = API.dequeuedJobs()
        jobdistr = API.processStatusDistribution()
        jobbyst = ''
        for couple in jobdistr:
            if len(couple) == 2:
                jobbyst += "<tr><td>&nbsp;&nbsp;%s</td><td>%s</td></tr>"%(str(couple[0]),str(couple[1]))
        table_job = '\n<table Class="Jobs"> %s </table><br/>'%jobbyst

        html += "<br/>Jobs in the GetOutput queue: %s Done + %s Failed = %s"%(str(outqueue[0][0]), str(outqueuefail[0][0]), str(outqueue[0][0]+outqueuefail[0][0]))
        html += "<br/>Jobs being processed by the JobTracking: %s"%str(JTload[0][0])
        html += "<br/>Jobs already processed by the GetOutput: %s"%str(dequeued[0][0])
        html += "<br/>Jobs by processing status: <br/>%s"%table_job

        html += '\n<br/><br/> <b>MySql DB size in MBytes</b><br/>\n<table Class="DBSize" >'

        path=os.environ.get("PRODAGENT_WORKDIR")
#.........这里部分代码省略.........
开发者ID:bbockelm,项目名称:CRAB,代码行数:103,代码来源:ComponentServicesMonitor.py


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