Difference between revisions of "Epics Logger Scripts for SBS"

From Hall A Wiki
Jump to: navigation, search
Line 2: Line 2:
 
the logging of information for the SBS.
 
the logging of information for the SBS.
  
== [[Explaining the EPICS logging scheme for SBS]] ==
+
== How to Add Variables to EPICS logging for SBS ==
 +
 
 +
<pre>
 +
1. Edit EpicsToFile, add your variable.
 +
2. Might want run this with TESTPRINT=1 and run EpicsToFile interactively to check it.  Don't forget to restore TESTPRINT=0.
 +
3. Kill the current running of EpicsToFile
 +
 
 +
[sbs-onl@adaq1 halla]$ ps awx | grep EpicsToFile
 +
 4018 pts/69   S+     0:00 grep --color=auto EpicsToFile
 +
10161 ?        S      1:03 /bin/ksh /adaqfs/home/sbs-onl/logentry_scripts/halla//EpicsToFile
 +
 
 +
kill -9 10161
 +
 
 +
4. Then wait.  The cron script "startCron" will restart it in a few minutes.  Perhaps check the process list to be sure.
 +
</pre>
 +
One fly in the ointment at the moment is that if someone is doing "less EpicsToFile" or "more EpicsToFile"
 +
on adaq1, then unfortunately startCron is not smart enough to restart EpicsToFile.  It is smart enough
 +
to ignore emacs sessions.  In the meantime, kill the "less" command, too.
 +
 
 +
<pre>
 +
[sbs-onl@adaq1 halla]$ ps awx | grep EpicsToFile
 +
2312 pts/69  T      0:00 less EpicsToFile
 +
3034 pts/69  S+    0:00 grep --color=auto EpicsToFile
 +
10161 ?        S      1:04 /bin/ksh /adaqfs/home/sbs-onl/logentry_scripts/halla//EpicsToFile
 +
 
 +
kill -9 2312
 +
kill -9 10161
 +
 
 +
</pre>
 +
 
 +
 
 +
== Explaining the EPICS logging scheme for SBS ==
 +
 
 
The EPICS data go to two places
 
The EPICS data go to two places
  
Line 9: Line 41:
 
2. datastream as event type 131
 
2. datastream as event type 131
  
First let me describe the scheme.
+
Let me describe the scheme.
  
 
A script called EpicsToFile runs continuously, using caget to obtain EPICS
 
A script called EpicsToFile runs continuously, using caget to obtain EPICS
Line 42: Line 74:
  
 
and getruninfo_bgr_SBS is called by
 
and getruninfo_bgr_SBS is called by
 
== [[How to Add Variables to EPICS logging for SBS]] ==
 
 
<pre>
 
1. Edit EpicsToFile, add your variable.
 
2. Might want run this with TESTPRINT=1 and run EpicsToFile interactively to check it.  Don't forget to restore TESTPRINT=0.
 
3. Kill the current running of EpicsToFile
 
 
[sbs-onl@adaq1 halla]$ ps awx | grep EpicsToFile
 
 4018 pts/69   S+     0:00 grep --color=auto EpicsToFile
 
10161 ?        S      1:03 /bin/ksh /adaqfs/home/sbs-onl/logentry_scripts/halla//EpicsToFile
 
 
kill -9 10161
 
 
4. Then wait.  The cron script "startCron" will restart it in a few minutes.  Perhaps check the process list to be sure.
 
</pre>
 
One fly in the ointment at the moment is that if someone is doing "less EpicsToFile" or "more EpicsToFile"
 
on adaq1, then unfortunately startCron is not smart enough to restart EpicsToFile.  It is smart enough
 
to ignore emacs sessions.  In the meantime, kill the "less" command, too.
 
 
<pre>
 
[sbs-onl@adaq1 halla]$ ps awx | grep EpicsToFile
 
2312 pts/69  T      0:00 less EpicsToFile
 
3034 pts/69  S+    0:00 grep --color=auto EpicsToFile
 
10161 ?        S      1:04 /bin/ksh /adaqfs/home/sbs-onl/logentry_scripts/halla//EpicsToFile
 
 
kill -9 2312
 
kill -9 10161
 
 
</pre>
 
 
back to https://hallaweb.jlab.org/wiki/index.php/Epics_Logger_Scripts_for_SBS
 
 
== How to add a variable ==
 
 
<pre>
 
1. Edit EpicsToFile, add your variable.
 
2. Might want run this with TESTPRINT=1 and run EpicsToFile interactively to check it.  Don't forget to restore TESTPRINT=0.
 
3. Kill the current running of EpicsToFile
 
 
[sbs-onl@adaq1 halla]$ ps awx | grep EpicsToFile
 
 4018 pts/69   S+     0:00 grep --color=auto EpicsToFile
 
10161 ?        S      1:03 /bin/ksh /adaqfs/home/sbs-onl/logentry_scripts/halla//EpicsToFile
 
 
kill -9 10161
 
 
4. Then wait.  The cron script "startCron" will restart it in a few minutes.  Perhaps check the process list to be sure.
 
</pre>
 
One fly in the ointment at the moment is that if someone is doing "less EpicsToFile" or "more EpicsToFile"
 
on adaq1, then unfortunately startCron is not smart enough to restart EpicsToFile.  It is smart enough
 
to ignore emacs sessions.  In the meantime, kill the "less" command, too.
 
 
<pre>
 
[sbs-onl@adaq1 halla]$ ps awx | grep EpicsToFile
 
2312 pts/69  T      0:00 less EpicsToFile
 
3034 pts/69  S+    0:00 grep --color=auto EpicsToFile
 
10161 ?        S      1:04 /bin/ksh /adaqfs/home/sbs-onl/logentry_scripts/halla//EpicsToFile
 
 
kill -9 2312
 
kill -9 10161
 
</pre>
 

Revision as of 17:39, 23 October 2022

Here is some technical information about how to add EPICS variables to the logging of information for the SBS.

How to Add Variables to EPICS logging for SBS

1. Edit EpicsToFile, add your variable.
2. Might want run this with TESTPRINT=1 and run EpicsToFile interactively to check it.  Don't forget to restore TESTPRINT=0.
3. Kill the current running of EpicsToFile

[sbs-onl@adaq1 halla]$ ps awx | grep EpicsToFile
 4018 pts/69   S+     0:00 grep --color=auto EpicsToFile
10161 ?        S      1:03 /bin/ksh /adaqfs/home/sbs-onl/logentry_scripts/halla//EpicsToFile

kill -9 10161

4. Then wait.  The cron script "startCron" will restart it in a few minutes.  Perhaps check the process list to be sure.

One fly in the ointment at the moment is that if someone is doing "less EpicsToFile" or "more EpicsToFile" on adaq1, then unfortunately startCron is not smart enough to restart EpicsToFile. It is smart enough to ignore emacs sessions. In the meantime, kill the "less" command, too.

[sbs-onl@adaq1 halla]$ ps awx | grep EpicsToFile
 2312 pts/69   T      0:00 less EpicsToFile
 3034 pts/69   S+     0:00 grep --color=auto EpicsToFile
10161 ?        S      1:04 /bin/ksh /adaqfs/home/sbs-onl/logentry_scripts/halla//EpicsToFile

kill -9 2312
kill -9 10161


Explaining the EPICS logging scheme for SBS

The EPICS data go to two places

1. HALOG -- both start-of-run and end-of-run.

2. datastream as event type 131

Let me describe the scheme.

A script called EpicsToFile runs continuously, using caget to obtain EPICS variables and put them into text files.

File to log EPICS data
/adaqfs/home/sbs-onl/logentry_scripts/halla/EpicsToFile

the text files are in /adaqfs/home/sbs-onl/logentry_scripts/halla/epics/halla.epics

Note, halla1.epics is rewritten frequently while halla.epics is a more stable copy that gets put into HALOG and datastream.

For the HV, its similar. A script /adaqfs/home/sbs-onl/logentry_scripts/HV_logging_SBS/EpicsLooper with data in the /Results subdirectory.

Other scripts insert the halla1.epics file into the datastream and into the HALOG.

All the scripts mentioned are in the directory /adaqfs/home/sbs-onl/logentry_scripts/halla/

InsertETLoop -- loops forever, puts halla.epics into ET system
as event type 131

getruninfo_bgr_SBS -- inserts EPICS data into HALOG.

and getruninfo_bgr_SBS is called by