/ %CERTIFY%

WebDisplayServer

Introduction

In this twiki you can find useful information about the server that manages the service Alignment Web Display

Web application description

The run-by-run alignment procedure was successfuly introduced in the T0 IDAlignmentCalibLoop on early 2011. This prompted a need for an easy way to access to the IDAlignmentCalibLoop output in order to spot ID misalignments as soon as posible and take an action.

The Web application consists in a server, managed by ATLAS Distributed Computing, and a collection of scripts to produce plots, update the information and handle the http requests.

Server

Information about the server can be found here

Alignment Web Display

The code can be found here. It's splitted in two parts:

  • database. In this folder you can find the scripts to update the information and to produce the heaviest plots in advance, before any user request in order to don't overload the server.
    • update_runs.sh Bash script to set up the environment properly and to execute the python script serverManageOutput.py. This script is executed by a cron job.
    • serverManageOutput.py Python script that looks for new runs in /afs/cern.ch/user/a/atlidali/w0/calibLoop/Tier0/data*. It updates the information for each run (number iterations, etc), store the alignlogfiles in the server and saves all the available information in server_runinfo20*.db
    • Monitor/makeplots.sh Bash script to set up the environment properly and to execute all the ploting scripts inside Monitor. This script makes all the residual plots and store them in the server for later requests from online users. This script is executed by a cron job.
  • WebPage. In this folder you can find the scripts to handle the http requests, build the HTML and jquery code needed to display the webpage, and the later but not least, all the python scripts to produce the alignment constants plots. These plots are done on demand by the online user.
    • index.py This script is the main code to handle the http requests. It's based on cherrypy, a light python framework to develop web applications.
    • environment.sh Bash script executed when an user request the production of plots. This script calls the python scripts inside plots folder to produce the plots. These plots are done on demand.

How to setup the Web application.

First, some words about users and permissions. The web service has to be attached to a real user. Then, there are two virtual users (almgadm, almgsrv) linked to the real one in order to manage the service. This is exactly the same as atlidali user. The real user can run anything as user almgadm and user almgadm can run anything as almgsrv.

Steps to log in the server

If you are the owner of the server:

   ssh user@aiadm.cern.ch
   ssh aiatlas012

Once you are inside the server, you can move to where all the software is stored, and please, take a look at the owners and permissions of each folder/file and respect them. This is, if you touch something, you have to do it with the same virtual user and respect the permissions if you don't know what are you doing or don't want to debug if something goes wrong.

cd /var/vhost/atlas-alignment/
ls -lh -> please, move around the different folders and take a look carefully to the users and permissions Then, if you need to update something, you have to change to the virtual users almgadm and almgsrv.
sudo -i -u almgadm
Then, if needed
sudo -i -u almgsrv
The folder /var/vhost/atlas-alignment/database is the same as the one described in the previous bullet. The foder /var/vhost/atlas-alignment/secure corresponds to the folder "WebPage" explained before. This naming convention is a standard for all the services managed by ADC, so, DON'T CHANGE THE NAME OF THIS FOLDER. With all this information, all you have to do now is to update the code, add new features... etc.

If you are NOT the owner of the server:

The only difference with respect to the previous bullet is the way to access to the server.
   ssh atlidali@aiadm.cern.ch
Then
   ssh almgadm@aiatlas012
or
   ssh almgsrv@aiatlas012

CRON jobs, Trouble Shooting

In 2015 there were some changes and updates on the servers managed by ADC that lead to some conflicts between the virtual users of the web service and the atlidali account. The solution taken was to change the owner of the different processes that need to read files inside atlidadi account. So, we use now acron instead of cron to schedule the execution of scripts. Information about acron can be found here. The main problem of this solution is that the REAL USER will be in charge of set up these jobs, cannot be delegated to a third user

The current configuration is:

02 */4 * * * aiatlas012 source /var/vhost/atlas-alignment/database/update_runs.sh
13 */4 * * * aiatlas012 source /var/vhost/atlas-alignment/database/Monitor/makeplots.sh

Due to this issue, the databases used by the web application have to be readable and writable by all members, as well as the folders to store the residuals/monitoring plots (previously, only almgadm was the one with these rights)

Due to unknown reasons, from time to time the information shown in the webpage is not updated, so, in order to avoid delays on showing new runs, we set up a cron job to restart the server with the same frecuency as the one used to look for new runs/make monitoring plots. This cron job has to be set up by almgadm user within the server:

  • Log in aiatlas012 as almgadm.
  • crontab -e
  • The current set up is: 29 */4 * * * /sbin/service httpd-atlas-alignment restart

Useful links, Twikis...

Details about virtual users, server... ATLASWebRedirectorService

-- SebastianPedraza - 2015-12-13

Edit | Attach | Watch | Print version | History: r3 < r2 < r1 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r3 - 2015-12-13 - SebastianPedraza
 
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    Sandbox All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2020 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
or Ideas, requests, problems regarding TWiki? use Discourse or Send feedback