The Loader

Steps for creating and loading a new SX federation

The following assumes that you have set up an "sxadmin" account with the commands to set up the appropriate environment in ~sxadmin/.sxrc, and that ~sxadmin/.cshrc includes the command source ~/.sxrc (to set env variables). Also, you should have already installed and compiled the sxGeneral, SpatialIndex, sxSchema and sxDatabase modules before loading the new federation. The sxGeneral/bin directory contains the sxmake perl script that replaces the make command for compiling SX code.
  1. Log in as sxadmin and choose the appropriate SX (if you have more than one SX on the same machine). This sets up all the necessary SX and Objectivity environment variables. On FNAL machines this is usually done by issuing:
    setup sxadmin -q sx-name, e.g.
    setup sxadmin -q edr, or
    setup sxadmin -q chunk

  2. cd $SXSCHEMA_DIR

  3. sxmake federation

  4. sxmake -debug -filter -terse clean sxSchema

  5. sxmake -debug -filter -terse -newschema all

  6. cd $SXLOADER_DIR

  7. sxmake -debug -filter -terse clean

  8. sxmake -debug -filter -terse all

  9. cd app

  10. sxInitSX

  11. cd ..
    bin/sxLoad -n /data1/sdssdata/chunk8 8
    (-n option lists the commands) 

  12. Pick the command you want if you only want to load part of the chunk, e.g.:
        /home/thakar/test/sxLoader/bin/sxLoader /data1/sdssdata/chunk8 8 1056 1 ;
    else just run the whole command (without -n option): 
        bin/sxLoad /data1/sdssdata/chunk8 8

Steps for loading spectra (sxLoadPlate)

Spectra are loaded after the photometric catalog has already been loaded, so that links from photo to spectro objects can be correctly set. Spectra are loaded plate by plate, using the sxLoadPlate command that is in sxLoader/bin, which should be in your path.
  1. Log in as sxadmin and choose whichever SX you want to load the plate into instead of "edr".

  2. For each plate, cd to the plates data directory and find the MJD(s) that need to be loaded by looking at the filenames in the data directory (there's usually only one MJD). For each valid MJD (i.e. for which the data is good), repeat steps 3 and 4.

  3. Make sure there is no other SX loader or server running for that SX. In particular, if the "startsx" script is running for that SX, you need to shut it down first and then the SX server if it is running. If you try to load a plate when there is another process accessing that database (especially a loader, which opens the database in update mode), it might CORRUPT THE DATABASE BEYOND REPAIR!

  4. Run sxLoadPlate: cd $SXLOADER_DIR/bin, or make sure that your "sxLoadPlate" is the correct one (in $SXLOADER_DIR/bin) by doing a "which sxLoadPlate". run the loadplate command as follows (example for data directory /data/spectro, plate 275, MJD 51910):

  5.    sxLoadPlate /data/spectro/1d_10/0275/1d 1 275 51910

    Specify the full path of the spectro data directory (where the spSpec files are) as the first parameter. The second parameter is the chunk-number, but it is not used any more and can be set to 1 for now.

    sxLoadPlate will take a couple of minutes to finish. It will list each fiber# as it completes loading it, and at the end say "Commit ... done".

Ani R. Thakar,
Last Modified: Apr 19, 2001.