IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 21, 2010, 2:45:13 PM (16 years ago)
Author:
eugene
Message:

merge changes from trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20100823/ippTasks/destreak.pro

    r29124 r29515  
    1010book init magicToDS
    1111book init magicDSToRevert
    12 book init magicDSToCleanup
    1312
    1413### indexes into Database lists
     
    3029$magicDSRevertStage = 0
    3130
     31macro destreak.show.stages
     32    echo $DS_STAGE:n stages enabled for destreak processing
     33    for i 0 $DS_STAGE:n
     34        echo $i $DS_STAGE:$i
     35    end
     36    echo current magicDSStage = $magicDSStage
     37    echo current magicDSRevertStage = $magicDSRevertStage
     38end
     39
    3240### Check status of tasks
    3341macro destreak.status
    34     # since echo and listbook output go to different files these do not come in order
    35     echo magicToDS
    3642    book listbook magicToDS
    37     echo magicDSToRevert
    3843    book listbook magicDSToRevert
    39     echo magicDSToCleanup
    40     book listbook magicDSToCleanup
    4144end
    4245
     
    4548    book init magicToDS
    4649    book init magicDSToRevert
    47     book init magicDSToCleanup
    4850end
    4951
     
    7375end
    7476
    75 macro destreak.cleanup.on
    76     task destreak.cleanup.load
    77         active true
    78     end
    79     task destreak.cleanup.run
    80         active true
    81     end
    82 end
    83 
    8477### Turn tasks off
    8578macro destreak.off
     
    10699    end
    107100end
    108 macro destreak.cleanup.off
    109     task destreak.cleanup.load
    110         active false
    111     end
    112     task destreak.cleanup.run
    113         active false
    114     end
    115 end
    116 
    117101
    118102task           destreak.load
     
    203187    book getword magicToDS $pageName camera -var CAMERA
    204188    book getword magicToDS $pageName streaks_uri -var STREAKS
     189    book getword magicToDS $pageName streaks_path_base -var STREAKS_PATH_BASE
    205190    book getword magicToDS $pageName inv_streaks_uri -var INV_STREAKS
     191    book getword magicToDS $pageName inv_streaks_path_base -var INV_STREAKS_PATH_BASE
    206192    book getword magicToDS $pageName stage -var STAGE
    207193    book getword magicToDS $pageName stage_id -var STAGE_ID
     
    229215    # TODO: do not add recoveryroot or replace if they are null or zero
    230216
    231     $run = magic_destreak.pl --magic_ds_id $MAGIC_DS_ID --camera $CAMERA --exp_id $EXP_ID --streaks $STREAKS --inv_streaks $INV_STREAKS --stage $STAGE --stage_id $STAGE_ID --component $COMPONENT --uri $URI --path_base $PATH_BASE --cam_path_base $CAM_PATH_BASE --cam_reduction $CAM_REDUCTION --outroot $OUTROOT --logfile $logfile --recoveryroot $RECROOT --replace $REPLACE --magicked $MAGICKED
     217    $run = magic_destreak.pl --magic_ds_id $MAGIC_DS_ID --camera $CAMERA --exp_id $EXP_ID --streaks_path_base $STREAKS_PATH_BASE --inv_streaks_path_base $INV_STREAKS_PATH_BASE --streaks $STREAKS --inv_streaks $INV_STREAKS --stage $STAGE --stage_id $STAGE_ID --component $COMPONENT --uri $URI --path_base $PATH_BASE --cam_path_base $CAM_PATH_BASE --cam_reduction $CAM_REDUCTION --outroot $OUTROOT --logfile $logfile --recoveryroot $RECROOT --replace $REPLACE --magicked $MAGICKED
    232218
    233219    add_standard_args run
     
    274260
    275261  periods      -poll $LOADPOLL
    276   #periods      -exec $LOADEXEC
    277262  periods      -exec 30
    278   periods      -timeout 60
     263  periods      -timeout 300
    279264  npending     1
    280265
     
    293278    add_poll_args run
    294279    add_poll_labels run
     280    # since this command can be expensive, reduce the limit
     281    $run = $run -limit 24
    295282    command $run
    296283  end
     
    317304task           destreak.revert.load
    318305  host         local
    319 
    320   periods      -poll $LOADPOLL
    321   periods      -exec $LOADEXEC
    322   periods      -timeout 20
     306  periods      -poll 60.0
     307  periods      -exec 120.
     308  periods      -timeout 120
    323309  npending     1
    324310  active       false
     
    518504end
    519505
    520 task           destreak.cleanup.load
    521   host         local
    522 
    523   periods      -poll $LOADPOLL
    524   periods      -exec $LOADEXEC
    525   periods      -timeout 20
    526   npending     1
    527   active       false
    528 
    529   stdout NULL
    530   stderr $LOGSUBDIR/destreak.cleanup.load.log
    531 
    532   task.exec
    533     $run = magicdstool -tocleanup
    534     if ($DB:n == 0)
    535       option DEFAULT
    536     else
    537 
    538       # save the DB name for the exit tasks
    539       option $DB:$magicDSToCleanup_DB
    540       $run = $run -dbname $DB:$magicDSToCleanup_DB
    541 
    542       # only bump database number after we have gone through all of the stages
    543       $magicDSToCleanup_DB ++
    544       if ($magicDSToCleanup_DB >= $DB:n) set magicDSToCleanup_DB = 0
    545     end
    546     add_poll_args run
    547     add_poll_labels run
    548     command $run
    549   end
    550 
    551   # success
    552   task.exit    0
    553     # convert 'stdout' to book format
    554     ipptool2book stdout magicDSToCleanup -key magic_ds_id -uniq -setword dbname $options:0 -setword pantaskState INIT
    555     if ($VERBOSE > 2)
    556       book listbook magicDSToCleanup
    557     end
    558 
    559     # delete existing entries in the appropriate pantaskStates
    560     process_cleanup magicDSToCleanup
    561   end
    562 
    563   # locked list
    564   task.exit    default
    565     showcommand failure
    566   end
    567 
    568   task.exit    crash
    569     showcommand crash
    570   end
    571 
    572   # operation times out?
    573   task.exit    timeout
    574     showcommand timeout
    575   end
    576 end
    577 
    578 task           destreak.cleanup.run
    579   periods      -poll $RUNPOLL
    580   periods      -exec $RUNEXEC
    581   periods      -timeout 60
    582   active       false
    583 
    584   task.exec
    585     stdout $LOGSUBDIR/destreak.cleanup.run.log
    586     stderr $LOGSUBDIR/destreak.cleanup.run.log
    587 
    588     # if we are unable to run the 'exec', use a long retry time
    589     periods -exec $RUNEXEC
    590 
    591     book npages magicDSToCleanup -var N
    592     if ($N == 0) break
    593     if ($NETWORK == 0) break
    594    
    595     # look for new images (pantaskState == INIT)
    596     book getpage magicDSToCleanup 0 -var pageName -key pantaskState INIT
    597     if ("$pageName" == "NULL") break
    598 
    599     book setword magicDSToCleanup $pageName pantaskState RUN
    600     book getword magicDSToCleanup $pageName magic_ds_id -var MAGIC_DS_ID
    601     book getword magicDSToCleanup $pageName camera -var CAMERA
    602     book getword magicDSToCleanup $pageName stage -var STAGE
    603     book getword magicDSToCleanup $pageName outroot -var OUTROOT
    604     book getword magicDSToCleanup $pageName dbname -var DBNAME
    605 
    606     sprintf logfile "%s/mds.%s.cleanup.log" $OUTROOT $MAGIC_DS_ID
    607 
    608     host anyhost
    609 
    610     $run = magic_destreak_cleanup.pl --magic_ds_id $MAGIC_DS_ID --stage $STAGE --camera $CAMERA --logfile $logfile
    611 
    612     add_standard_args run
    613 
    614     # save the pageName for future reference below
    615     options $pageName
    616 
    617     # create the command line
    618     if ($VERBOSE > 1)
    619       echo command $run
    620     end
    621     # if we are ready to run, drop the retry timeout low so we fill up the queue
    622     periods -exec 0.05
    623     command $run
    624   end
    625 
    626   # default exit status
    627   task.exit    0
    628     process_exit magicDSToCleanup $options:0 $JOB_STATUS
    629    end
    630 
    631   # locked list
    632   task.exit    default
    633     showcommand failure
    634     process_exit magicDSToCleanup $options:0 $JOB_STATUS
    635   end
    636 
    637   task.exit    crash
    638     showcommand crash
    639     book setword magicDSToCleanup $options:0 pantaskState CRASH
    640   end
    641 
    642   # operation timed out?
    643   task.exit    timeout
    644     showcommand timeout
    645     book setword magicDSToCleanup $options:0 pantaskState TIMEOUT
    646   end
    647 end
    648 
Note: See TracChangeset for help on using the changeset viewer.