/cms-dashboard-collect

Automatic retrieval of CERN LHC/CMS dashboard site metrics into Pandas data frames

Primary LanguagePython

Automatic collection of CMS dashboard values into tables

1 Collecting site metrics from the CERN LHC/CMS dashboard

Ths little prototype library dashboardmetrics.py enables one to get tabular data in the form of Pandas data frames from the dashboard REST services (compare to visualizations on the Dashboard).

from dashboardmetrics import *

start = '2017-05-05'
end = '2017-05-26'
mysite = 'T2_CH_CSCS'

df = get_metricstable(start, end, mysite)

print df
		  good_cpu_h  all_cpu_h  good_wallt_h  all_wallt_h  good_wallt_%  \
jobtype                                                                        
analysistest         0.0        0.3           0.0          1.9           0.0   
hctest            4221.3     4233.0        5013.2       7213.2          69.5   
production         267.1      267.1         283.1        390.4          72.5   
reprocessing      1756.9     1756.9        2051.8       2051.9         100.0   
hcxrootd           942.0      944.7        1480.2       1571.9          94.2   
psst                 0.0        0.0           0.0          0.0           NaN   
analysis        105662.1   133938.9      165278.4     326166.2          50.7   
unknown              0.0        0.0           0.0          0.0           NaN   
ALL_JOBS        112849.4   141140.9      174106.7     337395.5          51.6   

		  good_cpu_eff_%  
jobtype                       
analysistest             0.0  
hctest                  99.7  
production             100.0  
reprocessing           100.0  
hcxrootd                99.7  
psst                     NaN  
analysis                78.9  
unknown                  NaN  
ALL_JOBS                80.0  

2 Nice table formatting for Emacs org mode

A little source snippet that will render nice tables within an org mode document. It makes use of my orgbabelhelper library which is described as part of my org mode babel examples on github (actually it is tangled from that org file). You can get it also directly from anaconda cloud.

import orgbabelhelper as obh
from dashboardmetrics import *

df = get_metricstable(start, end, mysite)

print obh.dataframe_to_orgtable(df, caption='Job statistics for %s from %s to %s' % (mysite,start,end),
				    hlines=[1,-1]
)
jobtypegood_cpu_hall_cpu_hgood_wallt_hall_wallt_hgood_wallt_%good_cpu_eff_%
analysistest0.00.30.01.90.00.0
hctest4221.34233.05013.27213.269.599.7
production267.1267.1283.1390.472.5100.0
reprocessing1756.91756.92051.82051.9100.0100.0
hcxrootd942.0944.71480.21571.994.299.7
psst0.00.00.00.0
analysis105662.1133938.9165278.4326166.250.778.9
unknown0.00.00.00.0
ALL_JOBS112849.4141140.9174106.7337395.551.680.0

This can easily be used within org document by using the CALL syntax

#+CALL: src_sitemetrics("2017-07-27", "2017-08-07")
jobtypegood_cpu_hall_cpu_hgood_wallt_hall_wallt_hgood_wallt_%good_cpu_eff_%
analysistest4.919.85.6205.22.724.7
hctest3430.13430.93759.23798.199.0100.0
production12298.312322.120557.830570.367.299.8
hcxrootd438.9440.0715.7737.597.099.8
analysis130556.9138486.4168971.0235659.771.794.3
unknown0.00.00.00.0
ALL_JOBS146729.1154699.2194009.3270970.871.694.8