A set of utilities to collect batch accounting data, store them in a database and publish them for display on an accounting portal. It also includes various tools to perform some batch monitoring, produce statistics, generate reports and draw plots from accounting information.
The different components (common
, loccol
, cecol
, pub
, cpuhours
)
are organised in Python modules sharing the batchacct
Python package:
- the
common
component contains thecommon.py
module providing the routines, constants and DB table schema information shared by the other modules; - the
loccol
component provides theacct.py
script, a daemon collecting data from accounting files to send them to the DB, andcreate.py
, a tool to create the accounting DB tables and useful indices; - the
cecol
component provides thewhisk.py
script, a daemon collecting data from CREAM CE BLAH files to send them to the DB; - the
pub
component provides thejoin.py
script which, when periodically run as a cron job, joins the data collected by theloccol
andcecol
components before publishing them for display on the accounting portal; - the
cpuhours
component contains thecpuhours.py
script which provides tools to plot information based on the accounting data stored in the DB.
Both the loccol
and cecol
components read accounting files generated by
schedulers and send the job records to the DB. The pub
component reads the job
records from the DB, processes them and sends them to a message broker or writes
them to files a message broker client can read.
The connection file which must be supplied to the different components contains the credentials necessary to connect to the DB. It should hold the following format:
username/password@dsn
The loccol
component expects LSF accounting files. It parses them by using a
modified PyLSF module. Likewise, the cecol
component expects BLAH accounting
files as generated by CREAM CEs and parses them by using the parse
generator
function defined in the common.py
module.
You can easily use another parser of yours if you need to read a different
type of accounting file. What you need to do is to pass a generator as second
argument (recs
) to the insert
function defined in the common.py
module.
This generator has to yield a dictionary of job record field name keys mapped to
their values.
The common
, loccol
, cecol
and pub
components are typically RPM-packaged
by subsequently running make sdist
and make rpm
.
The cpuhours.py
script isn't provided with any packaging yet, but you can
run it -- or any of the other scripts -- in place, without RPM-installing
anything. This is possible by simply adding the path to the common.py
module
to your PYTHONPATH
. For instance, if your working directory is that of the
cpuhours.py
script, you may want to run on command along the lines of:
cpuhours/batchacct% PYTHONPATH=../../common/batchacct:$PYTHONPATH
cpuhours/batchacct% python cpuhours.py -c connectionfile
-
Starting the
acct.py
daemon to read accounting files and send job records to the DB:loccol/batchacct% python acct.py --connfile connectionfile --acctfile /path/to/accountingfile --pidfile /var/run/batchacct/loccol.pid --logfile /var/log/batchacct/loccol.log
-
Likewise, starting the
whisk.py
daemon to read CREAM CE BLAH accounting files and send job records to the DB:cecol/batchacct% python whisk.py --connfile connectionfile --acctdir /path/to/accountingdir/ --pidfile /var/run/batchacct/cecol.pid --logfile /var/log/batchacct/cecol.log
-
Launching the
join.py
daemon to read job records from the DB and write them to message files for a message broker client to further report them. Note the--conf
option which specifies a file holding reporting settings (see the example inpub/pub
) and the--vofile
option which specifies a file containing VO-to-group mappings (see the example inpub/vos
):pub/batchacct% python join.py --acctdbfile connectionfile --conf /path/to/pubconf --vofile /path/to/vofile --ssm /path/to/outgoing/messages/ --logfile /var/log/batchacct/pub.log
Each of the acct.py
, create.py
, whisk.py
, join.py
and cpuhours.py
scripts can be passed the -h
option to print out a summary of the available
options along with a short description.