IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 2, 2008, 9:38:51 AM (18 years ago)
Author:
eugene
Message:

substantial changes to implement new flatcorr paradigm

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippTasks/flatcorr.pro

    r16298 r19329  
    66check.globals
    77
    8 $LOGSUBDIR = $LOGDIR/flatcorr
    9 exec mkdir -p $LOGSUBDIR
    10 
    11 book init flatcoorBook
     8book init flatcorrBook
    129
    1310macro flatcorr.reset
     
    2017
    2118macro flatcorr.on
    22   task flatcorr.init
     19  task flatcorr.load
    2320    active true
    2421  end
     22  task flatcorr.run
     23    active true
     24  end
    2525end
    2626
    2727macro flatcorr.off
    28   task flatcorr.init
     28  task flatcorr.load
    2929    active false
    3030  end
     31  task flatcorr.run
     32    active false
     33  end
    3134end
    3235
    3336# these variables will cycle through the known ippdb database names
    34 $calInit_DB = 0
    35 
    36 # we have three steps here:
    37 # 1) get the list of dvo databases:  caltool -dbs
    38 # 2) define a new flatcorr run for each of the dvo dbs
    39 #    caltool
     37$flatcorr_addcamera_DB = 0
     38$flatcorr_pendingprocess_DB = 0
     39
     40# a flat-field correction run is initiated (manually) with a command like:
     41# flatcorr -definebyquery -filter r ...
     42# the result is a flatcorrRun entry, a set of chipRun entries, a linking list in flatcorrChipList. 
     43# the chipRun entries are all set to stop at the "chip" stage.
     44
     45# we also can define a run with:
     46# flatcorr -definerun
     47# flatcorr -addchip ...
     48
     49# as the chip analysis progresses, we need to occasionally migrate the
     50# completed chips to the camera stage by calling:
     51# flatcorr -addcamera
     52
     53# we wait for the completed chip and camera analysis and search for
     54# completed processing analysis with:
     55# flatcorr -pendingprocess
     56
     57# these define arguments to an analysis run.  successful completion of
     58# the analysis is marked with:
     59# flatcorr -addprocess
     60# and failures with:
     61# flatcorr -addprocess -fault N
     62
     63# migrate complete flatcorr chips to the camera stage analysis
     64task           flatcorr.addcamera
     65  host         local
     66
     67  # check the list of pending flatcorr runs
     68  periods      -poll 10
     69  periods      -exec 120
     70  periods      -timeout 60
     71  npending 1
     72
     73  # define the command (does not depend on previous queries)
     74  if ($DB:n == 0)
     75    command flatcorr -addcamera
     76  else
     77    # save the DB name for the exit tasks
     78    # note that this DB name refers to the ippdb, not the dvodb
     79    option $DB:$flatcorr_addcamera_DB
     80    command flatcorr -addcamera -dbname $DB:$flatcorr_addcamera_DB
     81    $flatcorr_addcamera_DB ++
     82    if ($flatcorr_addcamera_DB >= $DB:n) set flatcorr_addcamera_DB = 0
     83  end
     84
     85  # silently drop stdout
     86  stdout NULL
     87  stderr $LOGDIR/flatcorr.log
     88
     89  # success (no action required)
     90  task.exit $EXIT_SUCCESS
     91  end
     92
     93  # locked list
     94  task.exit    default
     95    showcommand failure
     96  end
     97
     98  # operation times out?
     99  task.exit    timeout
     100    showcommand timeout
     101  end
     102end
    40103
    41104# create new flatcorr entries for the currently known DVO databases
     
    52115  # define the command (does not depend on previous queries)
    53116  if ($DB:n == 0)
    54     command flatcorr -pending
     117    command flatcorr -pendingprocess
    55118  else
    56119    # save the DB name for the exit tasks
    57     # note that this DB name refers to the ippdb, not the dvodb
    58     option $DB:$calInit_DB
    59     command flatcorr -pending -dbname $DB:$calInit_DB
    60     $calInit_DB ++
    61     if ($calInit_DB >= $DB:n) set calInit_DB = 0
     120    option $DB:$flatcorr_pendingprocess_DB
     121    command flatcorr -pendingprocess -dbname $DB:$flatcorr_pendingprocess_DB
     122    $flatcorr_pendingprocess_DB ++
     123    if ($flatcorr_pendingprocess_DB >= $DB:n) set flatcorr_pendingprocess_DB = 0
    62124  end
    63125
    64126  # silently drop stdout
    65127  stdout NULL
    66   stderr $LOGSUBDIR/flatcorr.log
     128  stderr $LOGDIR/flatcorr.log
    67129
    68130  # success
    69131  task.exit $EXIT_SUCCESS
    70     # convert 'stdout' to book format
    71     # XXX have ippTools report the dbname?
    72     ipptool2book stdout flatcorrBook -key dbname:corr_id -uniq -setword dbname $options:0 -setword pantaskState INIT
     132    ipptool2book stdout flatcorrBook -key corr_id -uniq -setword dbname $options:0 -setword pantaskState INIT
    73133    if ($VERBOSE > 2)
    74134      book listbook flatcorrBook
     
    90150end
    91151
    92 # create new flatcorr entries for the currently known DVO databases
    93 # run this multiple times once an hour - one pass for each db
    94 # can we include information that the db has been updated without a recent cal analysis?
     152# check for flatcorr runs which are ready to go
    95153task           flatcorr.run
    96154  host         local
     
    99157  periods      -exec $LOADEXEC
    100158  periods      -timeout 60
    101   # trange     Hourly@00:00 Hourly@00:10
    102   # every hour on the hour
    103   npending     1
    104159
    105160  # silently drop stdout
    106   stdout NULL
    107   stderr $LOGSUBDIR/flatcorr.log
     161  stdout $LOGDIR/flatcorr.log
     162  stderr $LOGDIR/flatcorr.log
    108163
    109164  task.exec
     
    112167    if ($NETWORK == 0) break
    113168   
    114     # look for new images in flatcorrBook
    115     # the sequencing in this task set is by the pantasksState (see notes.txt)
     169    # look for new entries in flatcorrBook
    116170    book getpage flatcorrBook 0 -var pageName -key pantaskState INIT
    117171    if ("$pageName" == "NULL") break
    118172
    119173    book setword flatcorrBook $pageName pantaskState     RUN
    120     book setword flatcorrBook $pageName region           $REGION
    121174
    122175    # XXX probably need to set the output / log based on WORKDIR...
    123     book getword flatcorrBook $pageName cal_id      -var ID
     176    book getword flatcorrBook $pageName corr_id     -var ID
    124177    book getword flatcorrBook $pageName dvodb       -var DVODB
    125178    book getword flatcorrBook $pageName region      -var REGION
    126179    book getword flatcorrBook $pageName filter      -var FILTER
    127180    book getword flatcorrBook $pageName dbname      -var DBNAME
     181    book getword flatcorrBook $pageName workdir     -var WORKDIR
    128182
    129183    # specify choice of remote host
     
    138192    options $pageName
    139193
     194    # XXX get these arguments right
    140195    $run = flatcorr_proc.pl --corr_id $ID --dvodb $DVODB --region $REGION --filter $FILTER
    141196    add_standard_args run
Note: See TracChangeset for help on using the changeset viewer.