IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 17, 2008, 3:55:36 PM (17 years ago)
Author:
bills
Message:

tasks for magic de-streaking

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippTasks/magic.pro

    r20760 r20790  
    88
    99### Initialise the books containing the tasks to do
    10 book init magicTree
    11 book init magicProcess
    12 book init magicMask
     10book init magicToTree
     11book init magicToProcess
     12book init magicToDS
    1313
    1414### Database lists
    15 $magicTree_DB = 0
    16 $magicProcess_DB = 0
    17 $magicMask_DB = 0
     15$magicToTree_DB = 0
     16$magicToProcess_DB = 0
     17$magicToDS_DB = 0
    1818
    1919### Check status of tasks
    2020macro magic.status
    21   book listbook magicTree
    22   book listbook magicProcess
    23   book listbook magicMask
     21  book listbook magicToTree
     22  book listbook magicToProcess
     23  book listbook magicToDS
    2424end
    2525
    2626### Reset tasks
    2727macro magic.reset
    28   book init magicTree
    29   book init magicProcess
    30   book init magicMask
     28  book init magicToTree
     29  book init magicToProcess
     30  book init magicToDS
    3131end
    3232
     
    4545    active true
    4646  end
    47   task magic.mask.load
    48     active true
    49   end
    50   task magic.mask.run
     47  task magic.destreak.load
     48    active true
     49  end
     50  task magic.destreak.run
    5151    active true
    5252  end
     
    5454
    5555### Turn tasks off
    56 macro magic.on
     56macro magic.off
    5757  task magic.tree.load
    5858    active false
     
    6767    active false
    6868  end
    69   task magic.mask.load
    70     active false
    71   end
    72   task magic.mask.run
     69  task magic.destreak.load
     70    active false
     71  end
     72  task magic.destreak.run
    7373    active false
    7474  end
     
    9292    else
    9393      # save the DB name for the exit tasks
    94       option $DB:$magicTree_DB
    95       command magictool -totree -limit 20 -dbname $DB:$magicTree_DB
    96       $magicTree_DB ++
    97       if ($magicTree_DB >= $DB:n) set magicTree_DB = 0
     94      option $DB:$magicToTree_DB
     95      command magictool -totree -limit 20 -dbname $DB:$magicToTree_DB
     96      $magicToTree_DB ++
     97      if ($magicToTree_DB >= $DB:n) set magicToTree_DB = 0
    9898    end
    9999  end
     
    102102  task.exit    0
    103103    # convert 'stdout' to book format
    104     ipptool2book stdout magicTree -key magic_id -uniq -setword dbname $options:0 -setword pantaskState INIT
     104    ipptool2book stdout magicToTree -key magic_id -uniq -setword dbname $options:0 -setword pantaskState INIT
    105105    if ($VERBOSE > 2)
    106       book listbook magicTree
     106      book listbook magicToTree
    107107    end
    108108
    109109    # delete existing entries in the appropriate pantaskStates
    110     process_cleanup magicTree
     110    process_cleanup magicToTree
    111111  end
    112112
     
    128128
    129129  task.exec
    130     book npages magicTree -var N
     130    book npages magicToTree -var N
    131131    if ($N == 0) break
    132132    if ($NETWORK == 0) break
    133133   
    134134    # look for new images (pantaskState == INIT)
    135     book getpage magicTree 0 -var pageName -key pantaskState INIT
     135    book getpage magicToTree 0 -var pageName -key pantaskState INIT
    136136    if ("$pageName" == "NULL") break
    137137
    138     book setword magicTree $pageName pantaskState RUN
    139     book getword magicTree $pageName magic_id -var MAGIC_ID
    140     book getword magicTree $pageName exp_id -var EXP_ID
    141     book getword magicTree $pageName camera -var CAMERA
    142     book getword magicTree $pageName workdir -var WORKDIR_TEMPLATE
    143     book getword magicTree $pageName dbname -var DBNAME
    144     book getword magicTree $pageName tess_id -var TESS_DIR
    145     book getword magicTree $pageName ra -var RA
    146     book getword magicTree $pageName decl -var DEC
     138    book setword magicToTree $pageName pantaskState RUN
     139    book getword magicToTree $pageName magic_id -var MAGIC_ID
     140    book getword magicToTree $pageName exp_id -var EXP_ID
     141    book getword magicToTree $pageName camera -var CAMERA
     142    book getword magicToTree $pageName workdir -var WORKDIR_TEMPLATE
     143    book getword magicToTree $pageName dbname -var DBNAME
     144    book getword magicToTree $pageName tess_id -var TESS_DIR
     145    book getword magicToTree $pageName ra -var RA
     146    book getword magicToTree $pageName decl -var DEC
    147147
    148148#    set.host.for.camera $CAMERA $MAGIC_ID
     
    184184  # default exit status
    185185  task.exit    default
    186     process_exit magicTree $options:0 $JOB_STATUS
     186    process_exit magicToTree $options:0 $JOB_STATUS
    187187  end
    188188
     
    190190  task.exit    timeout
    191191    showcommand timeout
    192     book setword magicTree $options:0 pantaskState TIMEOUT
     192    book setword magicToTree $options:0 pantaskState TIMEOUT
    193193  end
    194194end
     
    211211    else
    212212      # save the DB name for the exit tasks
    213       option $DB:$magicTree_DB
    214       command magictool -toprocess -limit 20 -dbname $DB:$magicProcess_DB
    215       $magicProcess_DB ++
    216       if ($magicProcess_DB >= $DB:n) set magicProcess_DB = 0
     213      option $DB:$magicToTree_DB
     214      command magictool -toprocess -limit 20 -dbname $DB:$magicToProcess_DB
     215      $magicToProcess_DB ++
     216      if ($magicToProcess_DB >= $DB:n) set magicToProcess_DB = 0
    217217    end
    218218  end
     
    221221  task.exit    0
    222222    # convert 'stdout' to book format
    223     ipptool2book stdout magicProcess -key magic_id:node -uniq -setword dbname $options:0 -setword pantaskState INIT
     223    ipptool2book stdout magicToProcess -key magic_id:node -uniq -setword dbname $options:0 -setword pantaskState INIT
    224224    if ($VERBOSE > 2)
    225       book listbook magicProcess
     225      book listbook magicToProcess
    226226    end
    227227
    228228    # delete existing entries in the appropriate pantaskStates
    229     process_cleanup magicProcess
     229    process_cleanup magicToProcess
    230230  end
    231231
     
    247247
    248248  task.exec
    249     book npages magicProcess -var N
     249    book npages magicToProcess -var N
    250250    if ($N == 0) break
    251251    if ($NETWORK == 0) break
    252252   
    253253    # look for new images (pantaskState == INIT)
    254     book getpage magicProcess 0 -var pageName -key pantaskState INIT
     254    book getpage magicToProcess 0 -var pageName -key pantaskState INIT
    255255    if ("$pageName" == "NULL") break
    256256
    257     book setword magicProcess $pageName pantaskState RUN
    258     book getword magicProcess $pageName magic_id -var MAGIC_ID
    259     book getword magicProcess $pageName exp_id -var EXP_ID
    260     book getword magicProcess $pageName node -var NODE
    261     book getword magicProcess $pageName camera -var CAMERA
    262     book getword magicProcess $pageName workdir -var WORKDIR_TEMPLATE
    263     book getword magicProcess $pageName dbname -var DBNAME
     257    book setword magicToProcess $pageName pantaskState RUN
     258    book getword magicToProcess $pageName magic_id -var MAGIC_ID
     259    book getword magicToProcess $pageName exp_id -var EXP_ID
     260    book getword magicToProcess $pageName node -var NODE
     261    book getword magicToProcess $pageName camera -var CAMERA
     262    book getword magicToProcess $pageName workdir -var WORKDIR_TEMPLATE
     263    book getword magicToProcess $pageName dbname -var DBNAME
    264264
    265265#    set.host.for.camera $CAMERA $MAGIC_ID
     
    298298  # default exit status
    299299  task.exit    default
    300     process_exit magicProcess $options:0 $JOB_STATUS
     300    process_exit magicToProcess $options:0 $JOB_STATUS
    301301  end
    302302
     
    304304  task.exit    timeout
    305305    showcommand timeout
    306     book setword magicProcess $options:0 pantaskState TIMEOUT
    307   end
    308 end
    309 
    310 task           magic.mask.load
     306    book setword magicToProcess $options:0 pantaskState TIMEOUT
     307  end
     308end
     309
     310task           magic.destreak.load
    311311  host         local
    312312
     
    316316  npending     1
    317317
    318 # this task is not ready to go yet
    319 active false
    320 
    321318  stdout NULL
    322   stderr $LOGDIR/magic.mask.log
     319  stderr $LOGDIR/magic.destreak.log
    323320
    324321  task.exec
    325322    if ($DB:n == 0)
    326323      option DEFAULT
    327       command magictool -tomask -limit 20
     324      command magicdstool -todestreak -limit 20
    328325    else
    329326      # save the DB name for the exit tasks
    330       option $DB:$magicMask_DB
    331       command magictool -tomask -limit 20 -dbname $DB:$magicMask_DB
    332       $magicMask_DB ++
    333       if ($magicMask_DB >= $DB:n) set magicMask_DB = 0
     327      option $DB:$magicToDS_DB
     328      command magicdstool -todestreak -limit 20 -dbname $DB:$magicToDS_DB
     329      $magicToDS_DB ++
     330      if ($magicToDS_DB >= $DB:n) set magicToDS_DB = 0
    334331    end
    335332  end
     
    338335  task.exit    0
    339336    # convert 'stdout' to book format
    340     ipptool2book stdout magicMask -key magic_id -uniq -setword dbname $options:0 -setword pantaskState INIT
     337    ipptool2book stdout magicToDS -key magic_ds_id:component -uniq -setword dbname $options:0 -setword pantaskState INIT
    341338    if ($VERBOSE > 2)
    342       book listbook magicMask
     339      book listbook magicToDS
    343340    end
    344341
    345342    # delete existing entries in the appropriate pantaskStates
    346     process_cleanup magicMask
     343    process_cleanup magicToDS
    347344  end
    348345
     
    358355end
    359356
    360 task           magic.mask.run
     357task           magic.destreak.run
    361358  periods      -poll $RUNPOLL
    362359  periods      -exec $RUNEXEC
    363360  periods      -timeout 60
    364361
    365 #this task is not ready to go yet
    366 active false
    367 
    368   task.exec
    369     book npages magicMask -var N
     362  task.exec
     363    book npages magicToDS -var N
    370364    if ($N == 0) break
    371365    if ($NETWORK == 0) break
    372366   
    373367    # look for new images (pantaskState == INIT)
    374     book getpage magicMask 0 -var pageName -key pantaskState INIT
     368    book getpage magicToDS 0 -var pageName -key pantaskState INIT
    375369    if ("$pageName" == "NULL") break
    376370
    377     book setword magicMask $pageName pantaskState RUN
    378     book getword magicMask $pageName magic_id -var MAGIC_ID
    379     book getword magicMask $pageName exp_id -var EXP_ID
    380     book getword magicMask $pageName camera -var CAMERA
    381     book getword magicMask $pageName workdir -var WORKDIR_TEMPLATE
    382     book getword magicMask $pageName dbname -var DBNAME
    383 
    384 #    set.host.for.camera $CAMERA $MAGIC_ID
    385 #    set.workdir.by.camera $CAMERA $MAGIC_ID $WORKDIR_TEMPLATE $default_host WORKDIR
     371    book setword magicToDS $pageName pantaskState RUN
     372    book getword magicToDS $pageName magic_ds_id -var MAGIC_DS_ID
     373    book getword magicToDS $pageName camera -var CAMERA
     374    book getword magicToDS $pageName streaks_uri -var STREAKS
     375    book getword magicToDS $pageName stage -var STAGE
     376    book getword magicToDS $pageName stage_id -var STAGE_ID
     377    book getword magicToDS $pageName component -var COMPONENT
     378    book getword magicToDS $pageName uri -var URI
     379    book getword magicToDS $pageName path_base -var PATH_BASE
     380    book getword magicToDS $pageName cam_path_base -var CAM_PATH_BASE
     381    book getword magicToDS $pageName outroot -var OUTROOT
     382    book getword magicToDS $pageName recoveryroot -var RECROOT
     383    book getword magicToDS $pageName re_place -var REPLACE
     384    book getword magicToDS $pageName remove -var REMOVE
     385    book getword magicToDS $pageName dbname -var DBNAME
     386
     387    sprintf logfile "%s/mgcds.%s.%s.%s.log" $OUTROOT $MAGIC_DS_ID $STAGE_ID $COMPONENT
     388
    386389    host anyhost
    387     $WORKDIR = $WORKDIR_TEMPLATE
    388 
    389     basename $TESS_DIR -var TESS_ID
    390     sprintf outroot "%s/%s/%s.mgc.%s.mask" $WORKDIR $EXP_ID $EXP_ID $MAGIC_ID
    391 
    392     ## generate output log based on filerule (convert the URI to a PATH)
    393     $logfile = `ipp_filename.pl --filerule LOG.EXP --camera $CAMERA --class_id $MAGIC_ID --basename $outroot`
    394     if ("$logfile" == "")
    395       echo "WARNING: logfile not defined in magic.tree.run"
    396       break
    397     end
    398 
    399     stdout $logfile
    400     stderr $logfile
    401     dirname $logfile -var outpath
    402     mkdir $outpath
    403 
    404     $run = magic_mask.pl --magic_id $MAGIC_ID --camera $CAMERA --outroot $outroot --logfile $logfile
     390
     391    # TODO: do not add recoveryroot, replace, or remove if they are null or zero
     392
     393    $run = magic_destreak.pl --magic_ds_id $MAGIC_DS_ID --camera $CAMERA --streaks $STREAKS --stage $STAGE --stage_id $STAGE_ID --component $COMPONENT --uri $URI --path_base $PATH_BASE --cam_path_base $CAM_PATH_BASE --outroot $OUTROOT
     394    # --recoveryroot $RECROOT --replace $REPLACE --remove $REMOVE
     395    # --logfile $logfile
    405396    add_standard_args run
    406397
     
    416407
    417408  # default exit status
    418   task.exit    default
    419     process_exit magicMask $options:0 $JOB_STATUS
     409  task.exit    0
     410    process_exit magicToDS $options:0 $JOB_STATUS
    420411   end
    421412
     413  # locked list
     414  task.exit    default
     415    showcommand failure
     416    process_exit magicToDS $options:0 $JOB_STATUS
     417  end
     418
    422419  # operation timed out?
    423420  task.exit    timeout
    424421    showcommand timeout
    425     book setword magicMask $options:0 pantaskState TIMEOUT
    426   end
    427 end
    428 
     422    book setword magicToDS $options:0 pantaskState TIMEOUT
     423  end
     424end
     425
Note: See TracChangeset for help on using the changeset viewer.