--
ViliusVisocka - 29-Apr-2010
Main information
The latest sources of the api are kept at SVN repository
https://svn.cern.ch/reps/dashboard/trunk/arda.dashboard.jobsmry
(last revision 14980)
The tool itself was deployed at dashboard02 server:
http://dashboard02.cern.ch/dashboard/request.py/jobmonitor
Things to remember
Time interval filter works inclusive: time1 >= n <= time2
Tool architechture
Tool consists of these main parts:
Application code:
- /arda.dashboard.jobsmry/lib/dashboard/http/actions/jobsmry/JobMonitor.py - Showing interface with filters
- /arda.dashboard.jobsmry/lib/dashboard/http/actions/jobsmry/JobMonitorShow.py - Retrieving params from GET, forming query and retrieving results to XML
Dao code:
- /arda.dashboard.jobsmry/lib/dashboard/dao/oracle/jobsmry/OracleJobSmryDAO.py - actually retrieving database from database
- /arda.dashboard.jobsmry/lib/dashboard/dao/oracle/jobsmry/sqlhelper.py - Contains helpers classes to form SQL queries
Templates:
- /arda.dashboard.jobsmry/templates/xsl/jobsmry/JobMonitor.xsl - Template for showing interface (Uses dojo)
- /arda.dashboard.jobsmry/templates/css/jobmonitor.css - style for interface template
- /arda.dashboard.jobsmry/templates/js/dailyJobSummary/jobmonitor.js - Some javascript to get filters and form URL
Extending API
Possibly tool will have to be extended to have more attributes or filters.
Here are the steps required for that:
- Include filter in interface template - possibly it will be multiple list of allowed values
- Pass list allowed values list to template from JobMonitor.py
- The list could be hardcoded, but more likely will be retrieved by dao (for example site list)
- Handle passes list in interface template showing it like form element (for example select box)
- Alter javascript to retrieve this filter value (to be passed by get)
- Modify getTextReportParams function in jobmonitor.js
function getTextReportParams(diagName) {
var params = new Array();
params.push("day1=" + dijit.byId("s3").value);
params.push("day2=" + dijit.byId("s4").value);
params.push("sites=" + getSites());
....
- Handle this filter in jobMonitorShow
- Modify sqlhelper
- Include new field in the results
class MonitorQuery(BaseMonitorQuery):
def __init__(self):
...
self.add_field_wctime()
-
-
- possibly add new table join
- possibly create a new filter
- Call created sqlhelper with parsed parameters
Updating plots from PHP to python
Some plots are implemented with
GraphTool which is compatible with Python.
Nevertheless few charts must be changed to avoid PHP dependency.
Destination of action mapping file ont dashboard02 server is:
/opt/dashboard/etc/dashboard-web
Main interactive view chart
The name of this action is:
jobsummary-plot-or-table and
jobsummary-plot (not used anymore??)
The view for this chart is:
dashboard.http.views.job.JobSummaryPHPplot.
To update a chart, change the view into one of these:
- dashboard.http.views.job.JobSummaryPlot - in case of NEW matplotlib version installed on the server
- dashboard.http.views.job.JobSummaryPlot - in case of OLD matplotlib version installed on the server
Action mapping snippet:
<action path="jobsummary-plot-or-table" method="GET" type="dashboard.http.actions.job.JobSummary"
description="JobSummary-plot" outputCache="600" actionCache="600">
<output format="*/*" contentType="text/html" type="dashboard.http.views.job.GenericXSLTView"
xsltDoc="xsl/job/JobSummary-table.xsl"/>
<!-- Choose this action for PHP version-->
<output format="application/image-map" type="dashboard.http.views.job.JobSummaryPHPplot"/>
<!-- Choose this action for Python with OLD version of MatPlotLib -->
<!-- <output format="application/image-map" type="dashboard.http.views.job.JobSummaryPlot2"/> -->
<!-- Choose this action for Python with NEW version of MatPlotLib -->
<!-- <output format="application/image-map" type="dashboard.http.views.job.JobSummaryPlot"/> -->
<output format="application/xhtml+xml" type="dashboard.http.views.job.GenericXSLTView"
xsltDoc="xsl/job/JobSummary-table.xsl"/>
<output format="text/xml" type="dashboard.http.views.GenericXMLView"/>
</action>
Popup charts (Overall, CPU, Running TIme..)
Here are the actions which use PHP based plot and needs to chage
view into "dashboard.http.views.job.GenericHistogramXHTMLViewPercentage2".
ExampleActions
- overalltime
- cputime
- jobwrappertime
- efficiency
- waitingtime
- runningtime
- waitingtime
Action mapping snippet:
<action path="runningtime" method="GET" type="dashboard.http.actions.job.CpuUsage">
<!-- PHP Plots -->
<!-- <output format="*/*" contentType="text/html"
type="dashboard.http.views.GenericHistogramXHTMLView"
xsltDoc="xsl/job/Runningtime-table.xsl" title="running time"/>
<output format="application/xhtml+xml" type="dashboard.http.views.GenericHistogramXHTMLView"
xsltDoc="xsl/job/Runningtime-table.xsl" title="running time"/> -->
<!-- Python Plot -->
<output format="*/*" contentType="text/html" type="dashboard.http.views.job.GenericHistogramXHTMLViewPercentage2"
xsltDoc="xsl/job/Runningtime-table.xsl" title="running time"/>
<output format="application/xhtml+xml" type="dashboard.http.views.job.GenericHistogramXHTMLViewPercentage2"
xsltDoc="xsl/job/Runningtime-table.xsl" title="running time"/>
<output format="text/xml" type="dashboard.http.views.GenericXMLView"/>
</action>