source: epicsdf/doc/build/html/_sources/installation.txt @ 608

Last change on this file since 608 was 608, checked in by jemian, 12 years ago

revise installation notes further

  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 11.7 KB
Line 
1.. $Id: installation.rst 607 2011-08-05 20:38:58Z jemian $
2
3Installation Instructions for Pilatus Detectors
4-------------------------------------------------------------------------------------------------
5
6There are several steps to the installation process.  This page was written during the
7installation of this code at 15ID-D on the USAXS/SAXS Pilatus 100k detector.  You might
8need to change some values to fit your situation.
9
10#. Install the EPICS database into an existing IOC.
11#. Install GUI support screens for MEDM or CSS-BOY
12#. Install Enthought Python Distribution with PyEPICS on Pilatus host computer.
13#. Install (and test and configure) ``epicsdf.py`` on Pilatus host computer.
14#. Start ``cron`` task to keep epicsdf.py running on Pilatus host computer.
15
16
17Install EPICS database in existing IOC
18^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
19
20These instructions assume the support database will run in an existing
21EPICS IOC.  In this example, ``<TOP>``
22is the absolute directory path to the IOC's top-level directory.
23In that directory, there will be some directory *someApp* where the source
24code for the IOC resides.
25
261. Check out support from subversion::
27
28     cd /tmp
29     svn co https://subversion.xor.aps.anl.gov/bcdaext/epicsdf epicsdf
30     cd epicsdf
31
322. Copy support database to ``<TOP>/someApp/Db`` directory::
33
34     cd /net/s15dserv/xorApps/epics/synApps_5_4/ioc/15iddLAX/15iddLAXApp/Db
35     cp /tmp/epicsdf/epics/epicsdf.db ./
36     svn add epicsdf.db
37     svn propset svn:eol-style native epicsdf.db
38     svn propset svn:keywords "Author Date Id Revision Url" epicsdf.db
39
403. Copy autosave request file to <TOP>/iocBoot/iocNAME directory::
41
42     cd /net/s15dserv/xorApps/epics/synApps_5_4/ioc/15iddLAX/iocBoot/ioc15iddLAX
43     cp /tmp/epicsdf/epics/epicsdf.req ./
44     svn add epicsdf.req
45     svn propset svn:eol-style native epicsdf.req
46     svn propset svn:keywords "Author Date Id Revision Url" epicsdf.req
47
484. Call support database from ``st.cmd`` file (edit that file and add like this *before* ``iocInit``)::
49
50     # 2011-08-01,PRJ
51     # database support for "df" command on Pilatus detector computer
52     # https://subversion.xor.aps.anl.gov/bcdaext/epicsdf/doc/build/html/index.html
53     dbLoadRecords("$(TOP)/15iddLAXApp/Db/epicsdf.db", "P=15iddLAX:,D=p100k:")
54
555. Register autosave request from ``auto_settings.req`` file (edit that file and add anywhere, usually at the end)::
56
57     # 2011-08-01,PRJ
58     # database support for "df" command on Pilatus detector computer
59     # https://subversion.xor.aps.anl.gov/bcdaext/epicsdf/doc/build/html/index.html
60     file epicsdf.req P=$(P),D=p100k:
61
62Keep the directory ``/tmp/epicsdf`` for use in the next step, to install the GUI support.
63
64
65Install GUI support
66^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
67
68There are support screens for MEDM and CSS-BOY in the ``epics/``
69subdirectory.
70
71* ``epics/epicsdf.adl`` : MEDM screen, needs macros ``P`` and ``D`` defined
72* ``epics/epicsdf.opi`` : CSS-BOY screen, needs macros ``P`` and ``D`` defined
73* ``epics/starter.opi`` : CSS-BOY screen, defines ``P`` and ``D`` and calls ``epicsdf.opi``
74
75Copy these screens to the appropriate directory for the tool you use::
76
77     cd /net/s15dserv/xorApps/epics/synApps_5_4/ioc/15iddLAX/15iddLAXApp/op/adl
78     cp /tmp/epicsdf/epics/epicsdf.adl ./
79     svn add epicsdf.adl
80
81The MEDM screen can be called from the command line with a command such as::
82
83   medm -x -macro P=15iddLAX:,D=p100k: epicsdf.adl &
84
85The directory ``/tmp/epicsdf`` can be discarded now.
86
87
88
89Install Enthought Python Distribution
90^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
91
92:warning: Procedure to install PyEPICS is flawed.
93  On Linux, fails to find libCom.so.3.14...
94  Works when matching libCom.so.(ver.sion) is copied to same place.
95
96These instructions describe installation of 32-bit support on the Pilatus host computer (usually SUSE Linux).
97
981. Copy deployment software to Pilatus host computer::
99
100     cd /tmp
101     svn co https://subversion.xor.aps.anl.gov/bcdaext/epd_deployment epd_deployment
102     cd epd_deployment
103     mkdir images
104 
1052. Copy Enthought installer to Pilatus host computer::
106
107    cp /APSshare/epd/downloads/epd-7.1-1-rh5-x86.sh ./images
108    chmod +x ./images/epd-7.1-1-rh5-x86.sh
109 
1103. Check the installation script for valid paths against what is available on the Pilatus host computer.
111    There are several scripts.  Here, just edit the macros in the 32-bit script
112   
113    * ``install-rhel5-32.sh``: installer shell script for 32-bit support
114
115    =============  ======================================================
116    macro          meaning
117    =============  ======================================================
118    ``SRC``        relative path to the Enthought installer script
119    ``LIBCA``      absolute path to EPICS ``libCa.so`` built for this OS
120    ``EPD_ROOT``   absolute path under which this EPD will be installed
121    =============  ======================================================
122   
123    :note: Consider adding the path defined by ``${EPD_ROOT}/bin``
124        to the shell ``PATH`` variable.
125   
126    :note: Suggest ``EPD_ROOT=/home/det/epd`` for Pilatus detectors.  This makes
127        the Python executable available at
128        ``/home/det/epd/epd-7.1-1-rh5-x86/bin/python``
129
1304. Run installation script::
131
132    /bin/sh ./install-rhel5-32.sh
133
134The directory ``/tmp/epd_deployment`` can be discarded now.
135
136Test PyEPICS
137~~~~~~~~~~~~
138
139Test the Python EPICS support (`PyEPICS <http://cars9.uchicago.edu/software/python/pyepics3/>`_)
140by printing the APS storage ring current.
141
142::
143
144   command_line> ${EPD_ROOT}/bin/python
145   import epics
146   print epics.caget('S:SRcurrentAI')
147   
148
149This can be run as
150
151    ${EPD_ROOT}/bin/python test_pyepics.py
152
153If this fails on the ``import epics`` statement, then the ``libCa.so`` module
154is probably not found.
155
156
157Install ``epicsdf`` Python client code
158^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
159
1601. Check out support from subversion::
161
162    cd ~
163    svn co https://subversion.xor.aps.anl.gov/bcdaext/epicsdf epicsdf
164    cd epicsdf
165
1662. Revise ``self.sender`` in :file:`src/epicsdf.py`.
167   Specify the name of a valid APS email address as the sender.
168   The :meth:`epicsdf.sendmail()`
169   sends mail using the ``mail`` program on the host operating system.  By default, the
170   Pilatus detectors are in the ``dectris.localdomain`` which is not allowed to send
171   mail within the APS.
172
173Test epicsdf
174~~~~~~~~~~~~
175
176Try running the program directly.  Note the program accepts a single PV prefix
177   as its argument (including the ``df:``)::
178
179    /home/det/epd/epd-7.1-1-rh5-x86/bin/python src/epicsdf.py 15iddLAX:p100:df:
180
181Configure ``epicsdf`` 
182~~~~~~~~~~~~~~~~~~~~~~~~
183
184Verify that the starter shell script ``shell/epicsdf.sh`` works properly.
185   Move to the ``shell`` directory and edit both files.  Adjust these items:
186   
187   ===================  =========================================================
188   macro                example value
189   ===================  =========================================================
190   DATABASE_PREFIX      15iddLAX:p100:df:
191   APP_BASE_DIR         /home/det/epicsdf
192   PYTHON               /home/det/epd/epd-7.1-1-rh5-x86/bin/python
193   ===================  =========================================================
194
195Test this by running each of these commands individually and looking at the output
196in the ``shell/epicsdf.log`` log file::
197
198   shell/epicsdf.sh start           # should start the program
199   shell/epicsdf.sh status          # should say program is running
200   shell/epicsdf.sh stop            # should stop program
201   shell/epicsdf.sh restart         # should start program
202   shell/epicsdf.sh restart         # should stop and then start program
203   shell/epicsdf.sh checkup         # does nothing this time
204   shell/epicsdf.sh stop            # should stop program
205   shell/epicsdf.sh checkup         # should start program
206   shell/epicsdf.sh checkup         # does nothing this time
207
208For convenience, you could also (enter the ``shell`` directory and)
209type ``make start``, ``make stop``, ...
210
211Note:
212The first time ``shell/epicsdf.sh`` is run, the log file will contain some
213error information since the PID file has not yet been created.  No problem
214for the first time.  Maybe some additional code will be added to work around this.
215**Ignore this error if it occurs the first time.**  You could even scrape it out
216of the log file.
217
218::
219
220     # ===== shell/epicsdf.sh start =====  Tue Aug  2 15:01:29 CDT 2011  ==================================
221     /bin/cat: /home/det/epicsdf/shell/epicsdf.pid: No such file or directory
222     ERROR: List of process IDs must follow -p.
223     ********* simple selection *********  ********* selection by list *********
224     -A all processes                      -C by command name
225     -N negate selection                   -G by real group ID (supports names)
226     -a all w/ tty except session leaders  -U by real user ID (supports names)
227     -d all except session leaders         -g by session OR by effective group name
228     -e all processes                      -p by process ID
229     T  all processes on this terminal     -s processes in the sessions given
230     a  all w/ tty, including other users  -t by tty
231     g  OBSOLETE -- DO NOT USE             -u by effective user ID (supports names)
232     r  only running processes             U  processes for specified users
233     x  processes w/o controlling ttys     t  by tty
234     *********** output format **********  *********** long options ***********
235     -o,o user-defined  -f full            --Group --User --pid --cols --ppid
236     -j,j job control   s  signal          --group --user --sid --rows --info
237     -O,O preloaded -o  v  virtual memory  --cumulative --format --deselect
238     -l,l long          u  user-oriented   --sort --tty --forest --version
239     -F   extra full    X  registers       --heading --no-heading --context
240                         ********* misc options *********
241     -V,V  show version      L  list format codes  f  ASCII art forest
242     -m,m,-L,-T,H  threads   S  children in sum    -y change -l format
243     -M,Z  security data     c  true command name  -c scheduling class
244     -w,w  wide output       n  numeric WCHAN,UID  -H process hierarchy
245     # started 9233: /home/det/epd/epd-7.1-1-rh5-x86/bin/python /home/det/epicsdf/src/epicsdf.py 15iddLAX:p100:df:
246
247
248Start periodic ``cron`` task 
249~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
250   
251To ensure that the Python client program is restarted wfter a host reboot
252(or some other reason it has stopped), a periodic cron task checks that
253there is a PID running on the system and that PID is our python job.  This
254is done by periodically calling::
255
256    epics/epicsdf.sh checkup
257
258which will start a new client program if it is not running.
259The ``cron`` task is started by::
260
261    crontab -e
262
263:note: You will probably need to know how to use the ``vi`` editor.  Good luck!
264
265Add these contents to the end of the list, save, and then quit the editor.
266(Runs a *checkup* every 5 minutes.)::
267
268    # cron task
269    #  epicsdf-
270    #     watch some local disk partition and report it to EPICS,
271    #     send emails if space runs low
272    */5 * * * * /home/det/epicsdf/shell/epicsdf.sh checkup
273
274
275a few VI editor commands
276~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
277
278These are the few VI editor commands to help you edit the ``cron`` task.
279The notation ``[esc]`` means to press the *escape* key.  If you need more
280help, you need the manual.
281
282============== ============================================
283command        meaning
284============== ============================================
285i              start *insert* mode (so you can enter text)
286[esc]          leave insert mode
287:w!            save: write the contents back to the file
288               but do not quit ``vi`` yet.
289:q!            quit: Leave the program.  If you have not
290               saved first with ``:w!``, your changes
291               will be lost -- forever.
292               This is how you do a *cancel - no save*.
293ZZ             save and quit
294============== ============================================
295
Note: See TracBrowser for help on using the repository browser.