Fork Me on GitHub

cmssh

Programmable shell for CMS experiment

Welcome to cmssh project.

The cmssh (CMS shell) is a part of CMS software initiative to simplify your daily activity in CMS environment. It as combination of data discovery, file mover and release management tools in one user-friendly shell which runs on your favorite OS, Mac or Linux. The code is based on IPython and provides access to find your favorite data, to copy desired LFNs from/to storage elements and local disk, manage your CMS releases, etc. Since it is based on python you can extended as you wish, e.g. you can write your own code, use matplotlib, etc. A brief introduction of cmssh capabilities are outlined in this talk.

Prerequisites

Installation

To install cmssh please download installer installer script and run it as

python cmssh_install.py --help

It will print out all options you can use during install procedure. Most of the time you'll run it as

python cmssh_install.py --install --dir=$PWD

Please note that python should be version 2.6 or above (but not python 3 yet) and you'll need to have your JAVA_HOME environment set, since cmssh uses GRID middleware based on java. But don't worry the install script will prompt you about that.

Installtion within CMSSW environment

If you want to install cmssh on a system with already existing CMSSW environment please use the following command:

python ./cmssh_install.py -i -d YOUR_INSTALL_AREA -v 1 --cmssw=YOUR_CMSSW_AREA --arch=YOUR_FAVORITE_ARCHITECTURE --multi-user

Please note that if you have multiple architectures in your CMSSW area you may specify any architecture you like. It will be used to build cmssh dependencies, but cmssh will be able to use CMSSW release from different architectures.

Usage

The usage of cmssh is very simple, in fact it is very similar to your normal shell. Here is a few basic commands you may find interesting:

search for some data

find dataset=*CRUZET3*RAW
for r in results(): print r, type(r)

ls/find/info command

ls /Cosmics/CRUZET3-v1/RAW
info /Cosmics/CRUZET3-v1/RAW
find file dataset=/Cosmics/CRUZET3-v1/RAW
find site dataset=/Cosmics/CRUZET3-v1/RAW
find run=160915
info run=160915

Every time you run a command in cmssh there is results() helper function which captures its output. It allows you to re-iterate over last command output. For example, if you run

find run=160915

you can iterate over results again by using

for r in results():
    # do something useful with r, e.g.
    print r.initLumi, type(r.initLumi), r.DeliveredLumi, type(r.DeliveredLumi)

find lumi information

lumi dataset=/Photon/Run2012A-29Jun2012-v1/AOD
lumi block=/Photon/Run2012A-29Jun2012-v1/AOD#3e33ce8e-c44d-11e1-9a26-003048f0e1c6
lumi file=/store/data/Run2012A/Photon/AOD/29Jun2012-v1/0000/001B241C-ADC3-E111-BD1D-001E673971CA.root
lumi run=190704
lumi {190704:[1,2,3,4], 201706:[1,2,3,67]}

list/copy LFN to local disk

ls /store/data/CRUZET3/Cosmics/RAW/path/file.root
cp /store/data/CRUZET3/Cosmics/RAW/path/file.root .

SE operations, e.g. list its content, create/delete directory, etc.

du T3_US_Cornell
ls T3_US_Cornell
ls T3_US_Cornell:/store/user/me
mkdir T3_US_Cornell:/store/user/me/foo
rmdir T3_US_Cornell:/store/user/me/foo

copy local file to SE

cp file.root T3_US_Cornell:/store/user/me

copy LFN from SE to local disk

cp T3_US_Cornell:/store/user/me/file.root .

delete file on SE

rm T3_US_Cornell:/xrootdfs/cms/store/user/me/file.root

copy LFN to SE area

cp /store/data/CRUZET3/Cosmics/RAW/path/file.root T3_US_Cornell:/store/user/me

copy multiple files in background

cp /store/data/CRUZET3/Cosmics/RAW/path/file1.root . &
cp /store/data/CRUZET3/Cosmics/RAW/path/file2.root . &

look-up file status in background (data queue)

dqueue

look-up available releases

releases

install your favorite release

If you install cmssh on your system withon --cmssw option, you'll be able to manually install CMSSW releases by using the following command

install CMSSW_X_Y_Z

Once CMSSW release is installed in your shell, you can simply invoke your favorite release as simple as

cmsrel CMSSW_X_Y_Z

This command will setup release area and you'll be ready to use it.

run cms job

Once CMSSW release is available in your shell (cmsrel CMSSW_X_Y_Z), you can run your cms run job as following

cmsRun runevt_cfg.py

Help and Support

You can find cmssh help by typing cmshelp in your shell. For more information please contact the author. For bugs please use GitHub tracking system.