Technical Documentation of the Offline QA Browser

Under:

This page is meant to document technical details of files and databases used by the Offline QA Browser. The databases reside on the duvall server.

  1. The FastOffline framework fills the operation/DAQInfo table with the names of DAQ files produced and information on the location of generated files from the production
  2. A program called "qa" (code is available in CVS under offline/QA/) operates as a CGI web interface. qa.c is 2,000+ lines of string manipulation, html output, and mysql queries.  To find (some of) the code for a certain page, check the switch statement in main (line 3709) for the function call pertaining to a given page number.  The mysql queries are mostly handled through the Query function defined in lib.h and lib.c.   A Makefile is available on orion under ~starqa/QA which compiles and installs the program on STAR's web server.     Here are the tasks it does for "FAST OFFLINE shift work":

    1. Query operation/DAQInfo for FastOffline jobs matching the cuts provided by the user.
    2. Query operation/FOLocations for the actual directory of the histograms for selected FastOffline jobs.
    3. Insert an entry into OfflineQA/hist2ps for QA jobs to process. The daemon monitors hist2ps for undone job requests and changes the status once the request has been performed.
    4. Wait for the status of that entry to change and obtain the list of output files.
    5. Generate a web page which provides links to the output histogram files and logs.
  3.  A daemon (~starqa/QA/daemon) runs continuously on rcas6004 to catch and process requests for histogram delivery. The daemon is started through a wrapper at ~starqa/bin/QAdaemon.  This checks to see if the daemon is already running and handles all of the AFS authentication.  Since the QAdaemon wrapper now handles the log files, the cron job becomes much simpler.  The crontab command is:                            * * * * * /star/u/starqa/bin/QAdaemon, which keeps the wrapper alive continuously.         

         Here are the overall task of daemon.c:

         1.Query OfflineQA/hist2ps for undone QA job requests.
         2. Execute appropriate bfcread_hist_files*.C macros
         3. Update the OfflineQA/hist2ps with the output and status of running the macro
         4. A crontab script (~starqa/bin/QAdaemon) runs to ensure that the daemon is running.
 
         Procedures:

         Starting the daemon interactively:

  • log on to the rssh gateway (with your own account)
  • log on to rcas6004 as starqa:  ssh starqa@rcas6004
  • run bin/QAdaemon
  • after running, delete the file ~/QA/marker

Stopping the daemon:

  • log on to rcas6004 as starqa (see above)
  • get the process id:  ps -ef | grep starqa
  • kill the daemon's process
  • delete the file ~/QA/marker
  • note: unless you stop the cron job, the daemon should automatically restart shortly

 

      Notes:

  • The cron job:  use the "crontab -l" command to see the current command.  "crontab -r" will remove it,  "crontab -e" will let you edit it (defaults to vi, you can set your $EDITOR environment variable), or "crontab filename" will replace it with the command(s) in the file filename.  I keep the current cron command in ~/QA/mycrontab (check this before using). 
  • As a check against having several daemons running simulataneously, the daemon stores it pid in the file ~/QA/marker.  When a new daemon is started, it checks for this file, and may refuse to run if the file is recent.  The new wrapper makes this largely unnecessary, so this may be removed in the future.  In the meantime, if on startup the daemon quits with the error message about another process already running, try deleting the marker file and starting the daemon again.

 

     4. QA database: The QA database is name OfflineQA and is served on duvall.star.bnl.gov.  This database stores information on which files have been analyzed by QA shift workers, stores requests for new histograms to be made, and is how the cgi script and the daemon communicate.

A (partial) list of tables in the QA DB:

  • hist2ps:  Requests from the cgi script to create histograms.  The daemon monitors this table for requests, and updates the entry when it has completed (or crashed).
  • fastOfflineHistory:  A history of who has examined what
  • reports:  Stores reports from QA shift workers
  • reviewed:  Lists job IDs and run numbers which have already been checked by QA.


Notes: 

  • To browse the database, you can use the mysql command line interface (mysqlshow would be preferable, but it can't get around the underscore in the database name).  Be careful that you do not make any changes
    • Type: 'mysql -h duvall.star.bnl.gov'  to open mysql
    • 'use test_Herb'  opens the QA DB
    • 'show tables'  lists the tables
    • 'describe <table>'  gives details about a certain table
    • 'select * from <table> limit 10'  will show 10 entries in a table