next up previous contents
Next: 13. Conclusion Up: CFHT Data Acquisition Previous: 11. Software Organization,   Contents

Subsections

12. The Observing ``Sessions''

12.1 History

At CFHT, we refer to the user account for an instrument and all of the software installed within it as the ``session''. Sessions which conform to the original design, which includes automatic clean-up, re-build, and release mechanisms are known as ``Pegasus sessions.'' Practically every session has enough manual edits and tweaks that the only way to restore the setup is from a simple archival backup. Newer sessions like ``megacam'', which build on Pegasus software have completely abandoned the auto-build design, are known as ``NEO'' (New Environment for Observing) sessions. These also lack any ``Pegasus Session Manager'' ( psm) tool bar at the top of the screen, but just launch a detector control window and a top-level ``RPM'' GUI at login time.

If the PSM is missing, ``background menus'' controlled by the Window Manager (should?) give at least these three options as a partial substitute for the missing PSM:

12.2 Template Session

Just as the username `` pegasus'' was a non-instrument-specific demo/testing session, the username `` neo'' (with home directory /h/neo) serves as a template for what we might want future sessions to look like. At the moment, it is unlikely that existing instrument sessions would work, though, if one just forced all the generic components of /h/neo into a specific session. Unfortunately the instrument-specific needs are not as well separated as they should be. It is hoped that neo might be useful in the following ways:

  1. Testbed
  2. Template for starting a new session (wircam, espadons, etc.)
  3. To diff against, to more easily highlight what the modifications in other sessions are, versus this ``baseline.''

The following subsections describe the generic NEO account, and also how to convert a Pegasus account to use as much of the NEO things (FVWM, Director, Detcom) as possible.

12.3 Components of a NEO session

This is a description of all of the files and programs that make up a CFHT observing ``session'' such as megacam, cfhtir, and instruments using DetCom as the source for FITS files. It is written from the point of view of setting up a new account from scratch.

12.3.1 Home directory and login (NIS)

The first step to create a data acquisition account (or any other user account, in fact) is to add an entry to the master NIS password database, currently on the machine ``niu'' in Waimea. This step is usually performed by the system administrator. Skip to step 2 if an account has already been created.

A typical observing account entry in /var/yp/src/passwd would look like this:


neo:xxxxxxxxxxxxx:1234:1000:New Environment for Observing:/h/neo:/apps/gnu/bin/bash

Notes:

The home directory should be located on a reliable RAID disk at the summit, and the entry in the autofs maps is maintained in the file /var/yp/src/autofs/SUNautomount/auto.h also on nui.


neo         noeau:/local/h/neo

would be the entry matching the passwd example above.

Finally, add the new user account to netgroups ``doubt'' and ``observer'' and push the changes out to all machines using the normal procedures.

12.3.2 Obsolete account files

If migrating an old account, all of the following files are obsolete, and at least some of the must be removed to avoid problems:


x11start.cfht - done by system wide startup scripts
.x11start*  - done by .fvwm-xstartup
.xprofile*  - done by .fvwm-xstartup
.xsession   - done by system wide fvwm.xsession
.Xdefaults  - system wide Xdefaults should contain everything necessary.
session     - now handled by system startup scripts, director, etc.
  TODO: Nothing handles make -C /cfht/src/observer config yet.
  TODO: Nothing handles checking that the session is not already in use.
  TODO: Nothing starts vstatus.
.sessionrc  - done by system wide fvwm scripts and .fvwm-initfunction
  TODO: Nothing checks for .disable
.cshrc      - system wide bash startup scripts take care of it
.login      - system wide bash startup scripts take care of it
.logout     - *If* you have one, see if there's anything in there
              that should be moved to sessionquit.
.mwmrc      - Ignored by fvwm
.twmrc      - Ignored by fvwm
.gnome      - Remove, xdm on Linux doesn't need it
.vue        - Remove, if prompted for window manager on HP, select FVWM.
.vueprofile - ``
.dt         - Remove, if prompted for window manager on Sun, select FVWM.
.dtprofile  - ``
.rhosts     - Remove for security
.ssh        - (directory) Remove for security
.colorsetup - Not used when feedback window is Director.
.,*.header  - Not used by DetCom (will be re-created if still using DetI).
core*       - No comment.
.,aloha.par - Aloha is gone :-(
.,genh.par  - Not needed.

Still more files, which are all vestiges of pre-DetCom detector control systems, should be removed to avoid the possibility of scripts obtaining incorrect pixel size or other chip information:


.,cccd.par
.,ccd.par
.,chip.par
.,detector.par
.,*.cfg
.,howccd.par
.,whichccd.par
.,template
.,raster.par
.,fraster.par

TODO: Make a kill-script which takes care of all this (making backups and verbose commentary along the way.)

12.3.3 Dot Files

Once an empty home directory exists, some dot-files must be set up to configure the account as an observing session. In addition to the files shown here, other dot-files may appear as a result of logging in and using various programs, but those listed here are believed to be the only ones necessary for a functioning session.

.fvwm-errors-HOSTNAME
This file will be created. All output from the rest of the setup scripts ends up here. HOSTNAME is usually the session host, except for very early messages from the login process, when it might be the name of the display host instead. Hint: ``ls -latr'' will list the most recently touched file(s) at the end of its output.

.dt/sessions/lastsession
This is only for HPs (and Suns?) to tell their greeter program not to use CDE. The file should contain a single line with:


/apps/wm/common/fvwm.xsession
which is the name of the script that sets things up and eventually executes fvwm.

.fvwm-options
This is a shell script (or any other type of executable) which can echo bash-syntax commands on its stdout. This provides a mechanism to set option variables or override defaults in the FVWM startup sequence. The following is an example of a complete .fvwm-options for a session that should run on noeau (regardless of where the user logs in)


#!/bin/sh
#
# .fvwm-options - Set some variables for /apps/wm/common/fvwm.xsession
#                 that select options for a Pegasus observing session.
#
SSO_HOST=noeau
SSO_WMNAME=fvwm2
SSO_PEGASUS=1
SSO_COLORS=pegasus
#
# send the variables to the fvwm startup script (calls this script w/ eval)
#
echo "SSO_HOST=$SSO_HOST       ; export SSO_HOST"
echo "SSO_WMNAME=$SSO_WMNAME   ; export SSO_WMNAME"
echo "SSO_PEGASUS=$SSO_PEGASUS ; export SSO_PEGASUS"
echo "SSO_COLORS=$SSO_COLORS   ; export SSO_COLORS"

The window manager for observing sessions is FVWM version 2, and the SSO_PEGASUS=1 setting causes CFHT Pegasus-specific root-menu options to appear. These root-menus are defined in the standard distribution in /apps/wm/, but are disabled for normal users.

Another use for the .fvwm-options script is to display a pre-login user interface. This could be used to get something like a user preference for default shell in terminal windows. Add this to the end of a session's .fvwm-options file use the Tcl/Tk script "sso" to gather preferences from the user:


if [ "$HOSTNAME" = "$SSO_HOST" ]; then
  #
  # If we are already on the real sessionhost, display
  # the GUI that lets the user choose a few extra options
  # related to the session before the window manager starts:
  #
  exec /apps/wm/common/sso
fi

IMPORTANT: Be sure to run "chmod +x" on the script to make it executable.

TODO: Have fvwm.xsession export SSO_* so .fvwm-options does not have to.

TODO: Is /apps/wm/common/sso useful to have in by default?

TODO: Set SSO_HOST to a DNS CNAME like $USER-session.cfht.hawaii.edu?

TODO: Make SSO_COLORS=pegasus the default if SSO_PEGASUS=1?

.fvwm-xstartup
This script is source'd, so it is not required to be executable. It sets a few environment variables which all CFHT observing sessions may want. These include:

The job of this script was previously done by ".xprofile" and ".x11start", but they are no longer used, and should be removed to avoid confusion.

CFH12K and MegaCam did not use this file, but nothing is broken by having the extra environment variables defined. So, again, this is a non-session-specific setup script.

TODO: Incorporate this script into /apps/wm/common/ and have it get executed if SSO_PEGASUS is set. Eliminate it from all home directories.

TODO: raster mess: make note that must copy raster-shift script to .director/bin until solution is found (see /h/moseev/.director/bin/raster) Also copy fraster for now? Latest hack: remove raster+fraster from PSM, and disable all rasters which originated from that interface (see /h/osis/.director/bin/raster). User types raster at the command line (or eventually, from the Expose form) and it sticks. Focus scripts that want to send a raster should be modified to send it in the DetCom style (without the extra "slot" argument that DetI takes) so that the new raster script will not ignore it. A prototype of the new raster.rpm form is in /h/osis/rpm/.

TODO: nexp - how to handle this? For now, need nexp and neo-par from  gecko/.director/bin/

.fvwm-initfunction - Like .fvwm-options, this should also be an executable (usually another shell script) and it is used to launch the session manager tool bar (PSM), director feedback window, and any initial sessionstart processes. The same script can be used by all sessions, since ``sessionstart'' itself figures out what needs to be started for this specific session, and ``.director/startup'' determines which agent programs need to be started. See also the descriptions of those two files, below.

This script runs once on each screen.


#!/bin/sh
#
# .fvwm-initfunction - Start session user interfaces.
#
# Director is started on StatusDisplay in a color rxvt terminal window.
#
if [ "$DISPLAY" = "$StatusDisplay" ]; then
  rxvt -pixmap none +sb -geometry 80x37-62-1 -e director &
fi
#
# All screens should wait for Director on StatusDisplay to be ready,
# so that logging facilities are completely ready.
#
echo "Waiting for director to be ready for log input"
if ( clicmd @running 60 ); then
  echo "Director is ready"
else
  echo "Director still not ready after 60 seconds!"
  # Abort the session somehow?
fi
#
# The main GUI (PSM and/or an exposure form) are started on MainDisplay.
#
if [ "$DISPLAY" = "$MainDisplay" ]; then
  sessionstart &
  psm -X
fi

TODO: MegaCam wants "director -s"!

TODO: Replace sessionstart, psm -X, hform startup with: sessionstart -gui?

TODO: Replace director invocation with start-cli script. sessionstart -cli?

TODO: Rip out NUMBER_OF_SCREEN and *Display stuff from megacam once .fvwm-xstartup is being used by megacam session.

TODO: Fix handler_status problem with geckoh, and remove hack from .fvwm-initfunction

TODO: Add timestamps to junk in .fvwm-errors-*

TODO: Confirm that there is no reason to (re)start roll during session logins. (OK)

TODO: Figure out best place to ensure $HOME and $HOME/bin are in the path.

TODO: Other stuff to be sourced from bashrc?

.fvwm-exitfunction
This is executed whenever anyone logs out of an FVWM session. It must run sessionquit (and sessionquit, like sessionstart, must decide what this specific session needs based on .,config). It also must decide whether or not to ``shutdown'' director. If the instrument is still on, director is left running so that it can be cloned, even if no X-Sessions are logged in. This also allows the alert notification mechanism (which delivers e-mail if a critical condition occurs with the instrument) to continue to operate even when the session is not ``logged in.'' Only megacam uses this at the moment. All other sessions want to shutdown on logout.

TODO: Implement check for whether or not to do shutdown.

TODO: director-4.27+ is required for shutdown feature/``-s'' option to work.

More general information on how .fvwm* files are handled in the CFHT environment are given in /apps/wm/common/fvwmstart.ps.

The only thing the window manager startup scripts do, for getting the command line part of the session going, is to start `` director'' without any options. If one wants to have just the command line part of a session, it is usually possible to `` su - username'' and then just run `` director'' as the session.

It is also possible to run the entire graphical session inside a window (vncviewer) using the script `` session-test'', run from your personal account.

.director/startup
However director is invoked, as long as the -p and -S options were not used, director will run any and all commands it finds in .director/startup when it starts as a master. (If you start more director processes by logging in, if the session allows it, or by su'ing and typing director, you will get a clone window, and the startup script is NOT re-run.)

For now, the contents of the .director/startup file specify

Typical syntax looks like this:


@-infosize 9
agent start -R -D -H deticli dethost1:/cfht/bin/detcom-3.47 ~/dsp/ltb.lod ~/dsp/lub.lod

The '@' and '-' characters do the same thing they do in a Makefile. (Don't echo the command itself, and don't stop executing if the command happens to fail.)

The "infosize 9" maximizes the number of debug/user info lines shown below the prompt area. 9 is probably only needed for engineering, so reduce it if you'd rather not confuse the user with DSP code version status, etc. Generally, since we're doing service observing, some of the low level info is good or at least harmless.

The -R and -D options tell director to (R)estart detcom automatically if it exits (or crashes) and that it is the (D)efault agent to receive any user commands that are not prefixed by a handle.

.,deti.par - Needs to be a link to .,detcom.par until all refs to deti.par (possibly just ccd?) are fixed.

TODO: Remove ``-H deticli'' when all scripts are updated.

TODO: Remove .,deti.par and use .,detcom.par.

TODO: Standardize a way to select detector host on the fly.

TODO: Add option to director that causes it to ignore .director/sessionhost, and remove comments below about it, and sessionhost.tmp.

.director/sessionhost
This is a ``bogus'' symbolic link. The contents are the hostname where a clone should go to find director's shared memory. In the way we use it at CFHT, the sessionhost link is removed by the main director process when it exits, so that SSO_HOST in .fvwm-options is the single place to change the session host. If .director/sessionhost exists without the presence of .director/sessionhost.tmp, it indicates that the link is not going to be cleaned up automatically by director when it exits. This is not the intended use at CFHT, so if you find `` sessionhost'' hanging around by itself, remove it manually, or director will be confused if you ever change the account's sessionhost.

$HOME/bin/go
$HOME/bin/ccd
$HOME/bin/ccdh
$HOME/bin/...
Symbolic links to "clicmd", which is in turn a link to /cfht/bin/clicmd. The actual version of these commands are all in .director/bin/ instead of the HOME/bin/ directory. The placeholders in HOME/bin/ only serve to cause these commands to execute within the context of director, even if they are typed in a shell outside of director.

$HOME/bin/*h
handlers, symbolic links to /cfht/bin/ versions of the instrument handlers needed for this session. All handlers that are called in a -B (BeginFits/pre-exposure) configuration must have been upgraded to use the status server FITS staging area.

The first step in this upgrade is to convert the handler to use libfh. Detailed directions for converting from libff to libfh are found on another page.

The code that makes it possible to dump keywords to the status server need to be incorporated into an fh->ss type library. For now, just cut-and-paste the lines from tcsh or geckoh. Those handlers are also good to look at as examples. NOTE: converted handlers are still 100 templates, DetI, and G3v3 detector software.

TODO: Add conversion recipes: FF_OBSTYPE -> ENV_OBSTYPE, FF_SEQ_NUM -> ENV_SEQNUM, FF_ETEMPLATE -> ENV_FFTEMPLATE

TODO: Incorporate fh->ss routines into a library.

TODO: Other programs needed in $HOME/bin: clicmd clicap clidup director3-3.33

TODO: Session runid and piname needs to be ignored!

.,config
This file needs a fair amount of hacking if you are starting from an old one that was for DetI, or even more so if the session was pre-DetI.

.,Makefile.ccd
Based on handler information found in the session .,config, a set of Makefile rules must be generated that specify which things to run before and after an exposure. By specifying exactly what depends on what, it is possible to allow as many exposure steps to run in parallel as possible. The latest .,Makefile.ccd for each account should be kept in /cfht/src/medusa/detcom/ccd-compat/, but check the session directory for last minute changes. For a new session, one of these must be generated by hand, which is not complex.

.director/bin/ccd
The CCD "momma" compatability wrapper that causes all Pegasus sessions to call appropriate DetCom commands when an exposure is required. Not for MegaCam and CFH12K. The latest ccd hacks are found in the source tree, in scripts subdirectory of ccd-compat. Again, be sure the check the most recently used observing sessions too.

.director/bin/ccdh
A link to ccd, which replaces both the old ccd momma *and* ccdh.

.director/bin/go
Just a wrapper for "ccd -go", except MegaCam and CFH12K, where it replaces ccd and does the initial exposure sequencing itself. The go script contains this:


#!/usr/bin/sh
if (( $# > 0 )) ; then
  iterations=$1
else
  iterations=1
fi
exec ccd -go -iterations ${iterations#0}

As always, it must be ``chmod +x''.

TODO: Move ``go'' into /cfht/bin/ and consolidate all session items that are just symlinks.

TODO: Remove INSTRUME from DetCom. Add to appropriate instrument handlers.

TODO: Sort out raster mess.

TODO: Why does ccd call HOME/bin/raster?

TODO: Install new version of ccd, now in gecko/.director/bin/

12.3.4 GUI Form(s)

The ``Expose'' button on the session manager runs ``ccd -X'' which now brings up hform, pointing at /h/USER/rpm/index.rpm. That file should be a link to "detcom.rpm", which in turn can be copied from gecko (until a better place is found for these files.)

TODO: Make installation of RPM forms cleaner.

In order to function, the detcom.rpm form must have access to rasters and current detcom status. Set up the following files like gecko:


.,neo.par
rpm/neo.par -> ../.,neo.par
rpm/detcom.par -> ../.,detcom.par
rpm/rasters.par
rpm/rasters.rpm ??

TODO: Fix rasters (already mentioned elsewhere too)

TODO: Move this stuff to the status server.

12.4 Misc

At CFHT, our Solaris and HP-UX platforms include CFHT-maintained system-wide directories /apps/wm/ and /apps/gnu/. All of the source code and "configure" options that can be used to build the software in these directories on another Unix-like platform are referenced in the file /apps/gnu/src/CFHT.README. The main areas of customization are in the Window manager configuration (FVWM 1.24r, and FVWM 2) and some of these customizations are CFHT- or even ``Pegasus''-specific.

NOTES:

Q+A:


next up previous contents
Next: 13. Conclusion Up: CFHT Data Acquisition Previous: 11. Software Organization,   Contents
Sidik Isani
2004-02-12