Globus FBSNG Job Manager Interface
==================================
By Anzar Afaq & Igog Mandrichenko (FNAL)

Installation:
-------------
Here are instructions to setup FBSNG Globus Job Manager

1. Copy the following 3 scripts to $GLOBUS_LOCATION/libexec directory

	globus-script-fbsng-poll 
	globus-script-fbsng-rm
	globus-script-fbsng-submit

   set protection masks for them to make them executable

2. Edit globus-script-fbsng-submit file and define values for the following
   variables below "FBSNG Job Manager settings" in the script:

    $FBSNG_SETUP_RUN_QUEUE - default queue to use for the job
    $FBSNG_SETUP_CLEANUP_QUEUE - default queue to use for the job
    $FBSNG_SETUP_IO_DIR - NFS-shared directory for temporary storage of
        scripts and stderr/stdout files
        This directory should be writeable by any user

3. Make necessary modifications below "Set up FBSNG environment" in
   all three scripts to make sure FBSNG environment (PATH, PYTHONPATH, etc.)
   is properly set up.
   
4. Globus needs to be configured to know about FBSNG Job Manager:

    Edit file setup-globus-gram-job-manager.pl and add 'fbsng' 
    to @all_jm_types variable. It should look like this:

	   my @all_jm_types = ('condor', 'easymcs', 'fork', 'glunix', 'grd', 
                    'loadleveler', 'lsf',
                    'nqe', 'nswc', 'pbs', 'pexec', 'prun',
                    'fbsng');

5. After setting up globus environment, run 

    setup-globus-gram-job-manager -help 
    
    and verify that "fbsng" has been added in the job manager list.

6. Now run 

    setup-globus-gram-job-manager -type fbsng
    
    This will perform the necessary setup for GRAM to use fbsng Job Manager.

7. Verify that $GLOBUS_LOCATION/etc/grid-services directory has a new file 
   jobmanager-fbsng.
   
8. Save existing jobmanager as jobmanager.save (mv jobmanager jobmanager.save) 
   and copy jobmanager-fbsng as jobmanager. This will make fbsng jobmanager
   as Default Job manager and all jobs will be submitted to it. 
   If you skip this step then you can submit jobs to fbsng jobmanager 
   by specifying jobmanager-fbsng in you job submit request. 

See also:
   
    http://www.globus.org/gt2/admin/guide-user.html.
    http://www.globus.org/gt2/admin/guide-configure.html#jobmanager

Structure of FBSNG Job:
-----------------------
FBSNG job submitted by GRAM Job Manager consists of 2 sections, GlobusMain
and _CleanUp. Example of resulting Jib Description File is:

    SECTION GlobusMain
      QUEUE = GlobusRun
      NUMPROC = 5
      EXEC =   /shared/tmp/1234/job_script.sh
      STDOUT = /shared/tmp/1234/proc.out.%n
      STDERR = /shared/tmp/1234/proc.err.%n

    SECTION _CleanUp
      QUEUE = GlobusCleanUp
      EXEC = /shared/tmp/1234/globus_clean.sh
      STDERR = /shared/tmp/1234/cleanup.err
      STDOUT = /shared/tmp/1234/cleanup.out
      DEPEND = ended(GlobusMain) || canceled(GlobusMain)

Section GlobusMain runs in the queue specified in GRAM request or
in the default run queue ($FBSNG_SETUP_RUN_QUEUE). It executes a script
created by the Job Manager and batch process stores output and error
files into shared directory.

Section CleanUp is supposed to collect all the output of the job, copy
it into the file as specified in GRAM request and remove all temporary
files created by and for the job.
