1 |
#this is conrolling sequence for cmssw
|
2 |
#will regulary check if cmssw is running
|
3 |
#and that .vis(.gz) are created
|
4 |
#in future move to another script
|
5 |
#need to wait, elsewere evaluate the rest of script before cmssw process created
|
6 |
#actually don't need but may be usefull in the future
|
7 |
sleep 50
|
8 |
|
9 |
ppid_cmsRun=$(ps -eo pid,ppid,user,command | grep "cmsRun $CMSSW_DIR/python/_tmp_cfg.py 2>&1 | tee $working_dir/cmssw_out.log" | grep bash | awk '{print $1}' )
|
10 |
|
11 |
if ! [ "$ppid_cmsRun" ]; then
|
12 |
echo "cmssw_control.ch : Can't find cmsRun parent process"
|
13 |
echo "cmssw_control.ch : If cmssw is running terminate it manually by ctrl+c"
|
14 |
exit
|
15 |
fi
|
16 |
|
17 |
pid_cmsRun=$(ps -eo pid,ppid,user,command | grep $ppid_cmsRun | grep cmsRun | grep -v bash | awk '{print $1}' )
|
18 |
if ! [ "$pid_cmsRun" ]; then
|
19 |
echo "cmssw_control.ch : Can't find cmsRun process"
|
20 |
echo "cmssw_control.ch : If cmssw is running terminate it manually by ctrl+c"
|
21 |
# exit
|
22 |
fi
|
23 |
|
24 |
cd $working_dir
|
25 |
#look on the created .vis files
|
26 |
test=0
|
27 |
vis_file=""
|
28 |
|
29 |
while [ "$( ps -eo pid,user,fname,status | grep $pid_cmsRun )" ]; do
|
30 |
if [ $test -eq 0 ]; then
|
31 |
vis_file=$(ls -1 | grep $sample_name | grep vis | grep -v _tmp_.vis | grep -v vis.gz )
|
32 |
if [ "$vis_file" ] ; then
|
33 |
if [ -f _tmp.vis ]; then rm _tmp_.vis; fi
|
34 |
#ls *.vis
|
35 |
ln -s $vis_file _tmp_.vis
|
36 |
test=1
|
37 |
fi
|
38 |
elif ! [ -f $vis_file ]; then
|
39 |
break
|
40 |
fi
|
41 |
sleep 1
|
42 |
done
|
43 |
|
44 |
#It doesn't work, frog load a file only once
|
45 |
#solve problem with output message, put in the frog terminal ?
|
46 |
#need to try later, when frog will be compatible with several vis files
|
47 |
if ! [ -f "$vis_file" ]; then
|
48 |
if [ -f "$vis_file.gz" ]; then
|
49 |
# echo ""
|
50 |
# echo "cmssw_control.ch : $vis_file was compressed and moved to $vis_file.gz"
|
51 |
# echo "cmssw_control.ch : Please relaunch the script to visualize events"
|
52 |
# echo ""
|
53 |
rm _tmp_.vis
|
54 |
# ln -s $vis_file.gz _tmp_.vis
|
55 |
fi
|
56 |
fi
|
57 |
#remouve temporary files for cmssw
|
58 |
if [ -f $CMSSW_DIR/python/$sample_name"_cff.py" ]; then
|
59 |
rm $CMSSW_DIR/python/$sample_name"_cff.py"
|
60 |
rm $CMSSW_DIR/python/$sample_name"_cff.pyc"
|
61 |
fi
|
62 |
if [ -f $CMSSW_DIR/python/_tmp_cfg.py ]; then
|
63 |
rm $CMSSW_DIR/python/_tmp_cfg.py
|
64 |
fi
|
65 |
|
66 |
exit
|