IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 3, 2010, 8:45:22 AM (16 years ago)
Author:
eugene
Message:

updates from trunk

Location:
branches/simmosaic_branches
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/simmosaic_branches

  • branches/simmosaic_branches/ippTasks/magic.pro

    r24726 r27839  
    1010book init magicToTree
    1111book init magicToProcess
    12 book init magicToDS
    13 book init magicDSToRevert
    1412
    1513### Database lists
    1614$magicToTree_DB = 0
    1715$magicToProcess_DB = 0
    18 $magicToDS_DB = 0
    19 $magicDSToRevert_DB = 0
    20 
    21 #list of stages
    22 $STAGE:n = 0
    23 list STAGE -add "raw"
    24 list STAGE -add "chip"
    25 list STAGE -add "camera"
    26 list STAGE -add "warp"
    27 list STAGE -add "diff"
    28 $magicDSRevertStage = 0
     16$magicRevertTree_DB = 0
     17$magicRevertNode_DB = 0
    2918
    3019### Check status of tasks
     
    3221  book listbook magicToTree
    3322  book listbook magicToProcess
    34   book listbook magicToDS
    35   book listbook magicDSToRevert
    3623end
    3724
     
    4027  book init magicToTree
    4128  book init magicToProcess
    42   book init magicToDS
    43   book init magicDSToRevert
    4429end
    4530
    4631### Turn tasks on
     32macro magic.revert.on
     33  task magic.revert.node
     34    active true
     35  end
     36  task magic.revert.tree
     37    active true
     38  end
     39end
     40
    4741macro magic.on
    4842  task magic.tree.load
     
    5852    active true
    5953  end
    60   task magic.destreak.load
    61     active true
    62   end
    63   task magic.destreak.run
    64     active true
    65   end
    66 end
    67 
    68 macro magic.ds.revert.on
    69     task magic.ds.revert.load
    70         active true
    71     end
    72     task magic.ds.revert.run
    73         active true
    74     end
    75 end
     54  magic.revert.on
     55end
     56
     57macro magic.revert.off
     58  task magic.revert.node
     59    active false
     60  end
     61  task magic.revert.tree
     62    active false
     63  end
     64end
     65
    7666### Turn tasks off
    7767macro magic.off
     
    8878    active false
    8979  end
    90   task magic.destreak.load
    91     active false
    92   end
    93   task magic.destreak.run
    94     active false
    95   end
    96 end
    97 
    98 macro magic.ds.revert.off
    99     task magic.ds.revert.load
    100         active false
    101     end
    102     task magic.ds.revert.run
    103         active false
    104     end
    105 end
    106 
     80  magic.revert.off
     81end
    10782
    10883task           magic.tree.load
     
    237212
    238213  periods      -poll $LOADPOLL
    239   periods      -exec $LOADEXEC
    240   periods      -timeout 30
     214#  periods      -exec $LOADEXEC
     215  periods      -exec 30
     216  periods      -timeout 300
    241217  npending     1
    242218
     
    330306    $WORKDIR = $WORKDIR_TEMPLATE
    331307
    332     sprintf outroot "%s/%s/%s.mgc.%s.%s" $WORKDIR $EXP_ID $EXP_ID $MAGIC_ID $NODE
    333 
    334     ## generate output log based on filerule (convert the URI to a PATH)
    335     ## caution with neb:// names here:
    336     # $logfile = `ipp_filename.pl --filerule LOG.EXP --camera $CAMERA --class_id $MAGIC_ID --basename $outroot`
    337     $logfile = $outroot.log
     308    sprintf baseroot "%s/%s/%s.mgc.%s" $WORKDIR $EXP_ID $EXP_ID $MAGIC_ID
     309
     310    $logfile = $baseroot.$NODE.log
    338311    if ("$logfile" == "")
    339312      echo "WARNING: logfile not defined in magic.process.run"
     
    346319    mkdir $outpath
    347320
    348     $run = magic_process.pl --magic_id $MAGIC_ID --camera $CAMERA --node $NODE --outroot $outroot --logfile $logfile
     321    $run = magic_process.pl --magic_id $MAGIC_ID --camera $CAMERA --node $NODE --baseroot $baseroot --logfile $logfile
    349322    add_standard_args run
    350323
     
    376349end
    377350
    378 task           magic.destreak.load
     351task magic.revert.node
    379352  host         local
    380353
    381   periods      -poll $LOADPOLL
    382   periods      -exec $LOADEXEC
    383   periods      -timeout 20
     354  periods      -poll 60.0
     355  periods      -exec 1800.0
     356  periods      -timeout 120.0
    384357  npending     1
    385358
    386359  stdout NULL
    387   stderr $LOGDIR/magic.destreak.log
    388 
    389   task.exec
    390     $run = magicdstool -todestreak -limit 32
     360  stderr $LOGSUBDIR/revertnode.log
     361
     362  task.exec
     363    if ($LABEL:n == 0) break
     364    $run = magictool -revertnode
    391365    if ($DB:n == 0)
    392366      option DEFAULT
    393367    else
    394368      # save the DB name for the exit tasks
    395       option $DB:$magicToDS_DB
    396       $run = $run -dbname $DB:$magicToDS_DB
    397       $magicToDS_DB ++
    398       if ($magicToDS_DB >= $DB:n) set magicToDS_DB = 0
    399     end
    400     add_poll_args run
     369      option $DB:$magicRevertNode_DB
     370      $run = $run -dbname $DB:$magicRevertNode_DB
     371      $magicRevertNode_DB ++
     372      if ($magicRevertNode_DB >= $DB:n) set magicRevertNode_DB = 0
     373    end
    401374    add_poll_labels run
    402375    command $run
     
    405378  # success
    406379  task.exit    0
    407     # convert 'stdout' to book format
    408     ipptool2book stdout magicToDS -key magic_ds_id:component -uniq -setword dbname $options:0 -setword pantaskState INIT
    409     if ($VERBOSE > 2)
    410       book listbook magicToDS
    411     end
    412 
    413     # delete existing entries in the appropriate pantaskStates
    414     process_cleanup magicToDS
    415380  end
    416381
     
    429394  end
    430395end
    431 
    432 task           magic.destreak.run
    433   periods      -poll $RUNPOLL
    434   periods      -exec $RUNEXEC
    435   periods      -timeout 60
    436 
    437   task.exec
    438     book npages magicToDS -var N
    439     if ($N == 0) break
    440     if ($NETWORK == 0) break
    441    
    442     # look for new images (pantaskState == INIT)
    443     book getpage magicToDS 0 -var pageName -key pantaskState INIT
    444     if ("$pageName" == "NULL") break
    445 
    446     book setword magicToDS $pageName pantaskState RUN
    447     book getword magicToDS $pageName exp_id -var EXP_ID
    448     book getword magicToDS $pageName magic_ds_id -var MAGIC_DS_ID
    449     book getword magicToDS $pageName camera -var CAMERA
    450     book getword magicToDS $pageName streaks_uri -var STREAKS
    451     book getword magicToDS $pageName stage -var STAGE
    452     book getword magicToDS $pageName stage_id -var STAGE_ID
    453     book getword magicToDS $pageName component -var COMPONENT
    454     book getword magicToDS $pageName uri -var URI
    455     book getword magicToDS $pageName path_base -var PATH_BASE
    456     book getword magicToDS $pageName inverse -var INVERSE
    457     book getword magicToDS $pageName cam_path_base -var CAM_PATH_BASE
    458     book getword magicToDS $pageName outroot -var OUTROOT
    459     book getword magicToDS $pageName recoveryroot -var RECROOT
    460     book getword magicToDS $pageName re_place -var REPLACE
    461     book getword magicToDS $pageName dbname -var DBNAME
    462 
    463     sprintf logfile "%s/%s.mds.%s.%s.%s.log" $OUTROOT $EXP_ID $MAGIC_DS_ID $STAGE_ID $COMPONENT
    464 
    465     substr $COMPONENT 0 3 COMP_HEAD
    466     if ("$COMP_HEAD" == "sky")
    467         set.host.for.skycell $COMPONENT
    468     else
    469         # assume component is a class_id, if not we will default to anyhost
    470         set.host.for.camera $CAMERA $COMPONENT
    471     end
    472 
    473     # TODO: do not add recoveryroot or replace if they are null or zero
    474 
    475     $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 --logfile $logfile --recoveryroot $RECROOT --replace $REPLACE
    476     if ("$INVERSE" == "T")
    477        # Inverse subtraction
    478        $run = $run --inverse
    479     end
    480 
    481     add_standard_args run
    482 
    483     # save the pageName for future reference below
    484     options $pageName
    485 
    486     # create the command line
    487     if ($VERBOSE > 1)
    488       echo command $run
    489     end
    490     command $run
    491   end
    492 
    493   # default exit status
    494   task.exit    0
    495     process_exit magicToDS $options:0 $JOB_STATUS
    496    end
    497 
    498   # locked list
    499   task.exit    default
    500     showcommand failure
    501     process_exit magicToDS $options:0 $JOB_STATUS
    502   end
    503 
    504   task.exit    crash
    505     showcommand crash
    506     book setword magicToDS $options:0 pantaskState CRASH
    507   end
    508 
    509   # operation timed out?
    510   task.exit    timeout
    511     showcommand timeout
    512     book setword magicToDS $options:0 pantaskState TIMEOUT
    513   end
    514 end
    515 
    516 task           magic.ds.revert.load
     396task magic.revert.tree
    517397  host         local
    518398
    519   periods      -poll $LOADPOLL
    520   periods      -exec $LOADEXEC
    521   periods      -timeout 20
     399  periods      -poll 60.0
     400  periods      -exec 1800.0
     401  periods      -timeout 120.0
    522402  npending     1
    523   active       false
    524403
    525404  stdout NULL
    526   stderr $LOGDIR/magic.ds.revert.log
    527 
    528   task.exec
    529     $run = magicdstool -torevert -stage $STAGE:$magicDSRevertStage
    530     $magicDSRevertStage ++
    531     if ($magicDSRevertStage >= $STAGE:n) set magicDSRevertStage = 0
    532 
     405  stderr $LOGSUBDIR/reverttree.log
     406
     407  task.exec
     408    if ($LABEL:n == 0) break
     409    $run = magictool -reverttree
    533410    if ($DB:n == 0)
    534411      option DEFAULT
    535412    else
    536 
    537413      # save the DB name for the exit tasks
    538       option $DB:$magicDSToRevert_DB
    539       $run = $run -dbname $DB:$magicDSToRevert_DB
    540 
    541       # only bump database number after we have gone through all of the stages
    542       if ($magicDSRevertStage == 0)
    543              $magicDSToRevert_DB ++
    544       end
    545       if ($magicDSToRevert_DB >= $DB:n) set magicDSToRevert_DB = 0
    546     end
    547     add_poll_args run
     414      option $DB:$magicRevertTree_DB
     415      $run = $run -dbname $DB:$magicRevertTree_DB
     416      $magicRevertTree_DB ++
     417      if ($magicRevertTree_DB >= $DB:n) set magicRevertTree_DB = 0
     418    end
    548419    add_poll_labels run
    549420    command $run
     
    552423  # success
    553424  task.exit    0
    554     # convert 'stdout' to book format
    555     ipptool2book stdout magicDSToRevert -key magic_ds_id:component -uniq -setword dbname $options:0 -setword pantaskState INIT
    556     if ($VERBOSE > 2)
    557       book listbook magicDSToRevert
    558     end
    559 
    560     # delete existing entries in the appropriate pantaskStates
    561     process_cleanup magicDSToRevert
    562425  end
    563426
     
    576439  end
    577440end
    578 
    579 task           magic.ds.revert.run
    580   periods      -poll $RUNPOLL
    581   periods      -exec $RUNEXEC
    582   periods      -timeout 60
    583   active       false
    584 
    585   task.exec
    586     book npages magicDSToRevert -var N
    587     if ($N == 0) break
    588     if ($NETWORK == 0) break
    589    
    590     # look for new images (pantaskState == INIT)
    591     book getpage magicDSToRevert 0 -var pageName -key pantaskState INIT
    592     if ("$pageName" == "NULL") break
    593 
    594     book setword magicDSToRevert $pageName pantaskState RUN
    595     book getword magicDSToRevert $pageName exp_id -var EXP_ID
    596     book getword magicDSToRevert $pageName magic_ds_id -var MAGIC_DS_ID
    597     book getword magicDSToRevert $pageName camera -var CAMERA
    598     book getword magicDSToRevert $pageName stage -var STAGE
    599     book getword magicDSToRevert $pageName stage_id -var STAGE_ID
    600     book getword magicDSToRevert $pageName component -var COMPONENT
    601     book getword magicDSToRevert $pageName path_base -var PATH_BASE
    602     book getword magicDSToRevert $pageName cam_path_base -var CAM_PATH_BASE
    603     book getword magicDSToRevert $pageName outroot -var OUTROOT
    604     book getword magciDSToRevert $pageName bytes -var BYTES
    605     book getword magciDSToRevert $pageName md5sum -var md5sum
    606 #    book getword magicDSToRevert $pageName recoveryroot -var RECROOT
    607     book getword magicDSToRevert $pageName re_place -var REPLACE
    608     book getword magicDSToRevert $pageName dbname -var DBNAME
    609 
    610     sprintf logfile "%s/%s.mds.revert.%s.%s.%s.log" $OUTROOT $EXP_ID $MAGIC_DS_ID $STAGE_ID $COMPONENT
    611 
    612     substr $COMPONENT 0 3 COMP_HEAD
    613     if ("$COMP_HEAD" == "sky")
    614         set.host.for.skycell $COMPONENT
    615     else
    616         # assume component is a class_id, if not we will default to anyhost
    617         set.host.for.camera $CAMERA $COMPONENT
    618     end
    619 
    620     $run = magic_destreak_revert.pl --magic_ds_id $MAGIC_DS_ID --camera $CAMERA --stage $STAGE --stage_id $STAGE_ID --component $COMPONENT --path_base $PATH_BASE --cam_path_base $CAM_PATH_BASE --outroot $OUTROOT --logfile $logfile --replace $REPLACE
    621 
    622     add_standard_args run
    623 
    624     # save the pageName for future reference below
    625     options $pageName
    626 
    627     # create the command line
    628     if ($VERBOSE > 1)
    629       echo command $run
    630     end
    631     command $run
    632   end
    633 
    634   # default exit status
    635   task.exit    0
    636     process_exit magicDSToRevert $options:0 $JOB_STATUS
    637    end
    638 
    639   # locked list
    640   task.exit    default
    641     showcommand failure
    642     process_exit magicDSToRevert $options:0 $JOB_STATUS
    643   end
    644 
    645   task.exit    crash
    646     showcommand crash
    647     book setword magicDSToRevert $options:0 pantaskState CRASH
    648   end
    649 
    650   # operation timed out?
    651   task.exit    timeout
    652     showcommand timeout
    653     book setword magicDSToRevert $options:0 pantaskState TIMEOUT
    654   end
    655 end
    656 
Note: See TracChangeset for help on using the changeset viewer.