IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 18787


Ignore:
Timestamp:
Jul 30, 2008, 11:53:27 AM (18 years ago)
Author:
Paul Price
Message:

Adding exposure-level tasks.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippTasks/fake.pro

    r18607 r18787  
    77
    88book init fakePendingImfile
     9book init fakePendingExp
    910
    1011macro fake.status
    1112  book listbook fakePendingImfile
     13  book listbook fakePendingExp
    1214end
    1315
    1416macro fake.reset
    1517  book init fakePendingImfile
     18  book init fakePendingExp
    1619end
    1720
     
    2326    active true
    2427  end
     28  task fake.exp.load
     29    active true
     30  end
     31  task fake.exp.run
     32    active true
     33  end
    2534end
    2635
     
    3241    active false
    3342  end
     43  task fake.exp.load
     44    active false
     45  end
     46  task fake.exp.run
     47    active false
     48  end
    3449end
    3550
    3651# this variable will cycle through the known database names
    37 $fake_DB = 0
     52$fakeImfile_DB = 0
     53$fakeExp_DB = 0
    3854
    3955# select images ready for fake analysis
     
    5773    else
    5874      # save the DB name for the exit tasks
    59       option $DB:$fake_DB
    60       command faketool -pendingimfile -limit 20 -dbname $DB:$fake_DB
    61       $fake_DB ++
    62       if ($fake_DB >= $DB:n) set fake_DB = 0
     75      option $DB:$fakeImfile_DB
     76      command faketool -pendingimfile -limit 20 -dbname $DB:$fakeImfile_DB
     77      $fakeImfile_DB ++
     78      if ($fakeImfile_DB >= $DB:n) set fakeImfile_DB = 0
    6379    end
    6480  end
     
    153169  end
    154170end
     171
     172
     173
     174
     175# select exposures ready for fake analysis
     176# new entries are added to fakePendingExp
     177# skip already-present entries
     178task           fake.exp.load
     179  host         local
     180
     181  periods      -poll $LOADPOLL
     182  periods      -exec $LOADEXEC
     183  periods      -timeout 30
     184  npending     1
     185
     186  stdout NULL
     187  stderr $LOGDIR/fake.exp.log
     188
     189  task.exec
     190    if ($DB:n == 0)
     191      option DEFAULT
     192      command faketool -pendingexp -limit 20
     193    else
     194      # save the DB name for the exit tasks
     195      option $DB:$fakeExp_DB
     196      command faketool -pendingexp -limit 20 -dbname $DB:$fakeExp_DB
     197      $fakeExp_DB ++
     198      if ($fakeExp_DB >= $DB:n) set fakeExp_DB = 0
     199    end
     200  end
     201
     202  # success
     203  task.exit    0
     204    # convert 'stdout' to book format
     205    ipptool2book stdout fakePendingExp -key fake_id -uniq -setword dbname $options:0 -setword pantaskState INIT
     206    if ($VERBOSE > 2)
     207      book listbook fakePendingExp
     208    end
     209
     210    # delete existing entries in the appropriate pantaskStates
     211    process_cleanup fakePendingExp
     212  end
     213
     214  # locked list
     215  task.exit    default
     216    showcommand failure
     217  end
     218
     219  # operation times out?
     220  task.exit    timeout
     221    showcommand timeout
     222  end
     223end
     224
     225# run the fake_exp.pl script on pending images
     226task           fake.exp.run
     227  periods      -poll $RUNPOLL
     228  periods      -exec $RUNEXEC
     229  periods      -timeout 60
     230
     231  task.exec
     232    book npages fakePendingExp -var N
     233    if ($N == 0) break
     234    if ($NETWORK == 0) break
     235   
     236    # look for new exposures in fakePendingExp (pantaskState == INIT)
     237    book getpage fakePendingExp 0 -var pageName -key pantaskState INIT
     238    if ("$pageName" == "NULL") break
     239
     240    book setword fakePendingExp $pageName pantaskState RUN
     241    book getword fakePendingExp $pageName camera -var CAMERA
     242    book getword fakePendingExp $pageName exp_id -var EXP_ID
     243    book getword fakePendingExp $pageName exp_tag -var EXP_TAG
     244    book getword fakePendingExp $pageName fake_id -var FAKE_ID
     245    book getword fakePendingExp $pageName workdir -var WORKDIR_TEMPLATE
     246    book getword fakePendingExp $pageName dbname -var DBNAME
     247    book getword fakePendingExp $pageName reduction -var REDUCTION
     248
     249    # specify choice of local or remote host based on camera and fake
     250    set.host.for.camera $CAMERA FPA
     251
     252    # set the WORKDIR variable
     253    set.workdir.by.camera $CAMERA FPA $WORKDIR_TEMPLATE $default_host WORKDIR
     254
     255    ## generate outroot specific to this exposure (& chip)
     256    sprintf outroot "%s/%s/%s.fk.%s" $WORKDIR $EXP_TAG $EXP_TAG $FAKE_ID
     257
     258    stderr $LOGDIR/fake.exp.log
     259    stderr $LOGDIR/fake.exp.log
     260
     261    $run = fake_exp.pl --exp_id $EXP_ID --fake_id $FAKE_ID --camera $CAMERA --outroot $outroot
     262    if ("$REDUCTION" != "NULL")
     263      $run = $run --reduction $REDUCTION
     264    end
     265    add_standard_args run
     266
     267    # save the pageName for future reference below
     268    options $pageName
     269
     270    # create the command line
     271    if ($VERBOSE > 1)
     272      echo command $run
     273    end
     274    command $run
     275  end
     276
     277  # default exit status
     278  task.exit    default
     279    process_exit fakePendingExp $options:0 $JOB_STATUS
     280  end
     281
     282  # operation timed out?
     283  task.exit    timeout
     284    showcommand timeout
     285    book setword fakePendingExp $options:0 pantaskState TIMEOUT
     286  end
     287end
Note: See TracChangeset for help on using the changeset viewer.