IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 24685 for trunk/ippTasks


Ignore:
Timestamp:
Jul 6, 2009, 12:53:30 PM (17 years ago)
Author:
bills
Message:

add but do not enable tasks for managing 'careful reverting' of faulted destreaked files

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippTasks/magic.pro

    r24675 r24685  
    1111book init magicToProcess
    1212book init magicToDS
     13book init magicDSToRevert
    1314
    1415### Database lists
    … …  
    1617$magicToProcess_DB = 0
    1718$magicToDS_DB = 0
     19$magicDSToRevert_DB = 0
     20
     21#list of stages
     22$STAGE:n = 0
     23list STAGE -add "raw"
     24list STAGE -add "chip"
     25#list STAGE -add "camera"
     26list STAGE -add "warp"
     27list STAGE -add "diff"
     28$magicDSRevertStage = 0
    1829
    1930### Check status of tasks
    … …  
    2233  book listbook magicToProcess
    2334  book listbook magicToDS
     35  book listbook magicDSToRevert
    2436end
    2537
    … …  
    2941  book init magicToProcess
    3042  book init magicToDS
     43  book init magicDSToRevert
    3144end
    3245
    … …  
    5366end
    5467
     68macro magic.ds.revert.on
     69    task magic.ds.revert.load
     70        active true
     71    end
     72    task magic.ds.revert.run
     73        active false
     74    end
     75end
    5576### Turn tasks off
    5677macro magic.off
    … …  
    7495  end
    7596end
     97
     98macro 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
     105end
     106
    76107
    77108task           magic.tree.load
    … …  
    95126      $run = $run -dbname $DB:$magicToTree_DB
    96127      $magicToTree_DB ++
    97       if ($magicToTree_DB >= $DB:n) set magicToTree_DB = 0
     128      if ($magicToTree_DB >= $DB:n) $magicToTree_DB = 0
    98129    end
    99130    add_poll_args run
    … …  
    477508end
    478509
     510task           magic.ds.revert.load
     511  host         local
     512
     513  periods      -poll $LOADPOLL
     514  periods      -exec $LOADEXEC
     515  periods      -timeout 20
     516  npending     1
     517  active       false
     518
     519  stdout NULL
     520  stderr $LOGDIR/magic.ds.revert.log
     521
     522  task.exec
     523    $run = magicdstool -torevert -stage $STAGE:$magicDSRevertStage
     524    $magicDSRevertStage ++
     525    if ($magicDSRevertStage >= $STAGE:n) set magicDSRevertStage = 0
     526
     527    if ($DB:n == 0)
     528      option DEFAULT
     529    else
     530
     531      # save the DB name for the exit tasks
     532      option $DB:$magicDSToRevert_DB
     533      $run = $run -dbname $DB:$magicDSToRevert_DB
     534
     535      # only bump database number after we have gone through all of the stages
     536      if ($magicDSRevertStage == 0)
     537             $magicDSToRevert_DB ++
     538      end
     539      if ($magicDSToRevert_DB >= $DB:n) set magicDSToRevert_DB = 0
     540    end
     541    add_poll_args run
     542    add_poll_labels run
     543    command $run
     544  end
     545
     546  # success
     547  task.exit    0
     548    # convert 'stdout' to book format
     549    ipptool2book stdout magicDSToRevert -key magic_ds_id:component -uniq -setword dbname $options:0 -setword pantaskState INIT
     550    if ($VERBOSE > 2)
     551      book listbook magicDSToRevert
     552    end
     553
     554    # delete existing entries in the appropriate pantaskStates
     555    process_cleanup magicDSToRevert
     556  end
     557
     558  # locked list
     559  task.exit    default
     560    showcommand failure
     561  end
     562
     563  task.exit    crash
     564    showcommand crash
     565  end
     566
     567  # operation times out?
     568  task.exit    timeout
     569    showcommand timeout
     570  end
     571end
     572
     573task           magic.ds.revert.run
     574  periods      -poll $RUNPOLL
     575  periods      -exec $RUNEXEC
     576  periods      -timeout 60
     577  active       false
     578
     579  task.exec
     580    book npages magicDSToRevert -var N
     581    if ($N == 0) break
     582    if ($NETWORK == 0) break
     583   
     584    # look for new images (pantaskState == INIT)
     585    book getpage magicDSToRevert 0 -var pageName -key pantaskState INIT
     586    if ("$pageName" == "NULL") break
     587
     588    book setword magicDSToRevert $pageName pantaskState RUN
     589    book getword magicDSToRevert $pageName exp_id -var EXP_ID
     590    book getword magicDSToRevert $pageName magic_ds_id -var MAGIC_DS_ID
     591    book getword magicDSToRevert $pageName camera -var CAMERA
     592    book getword magicDSToRevert $pageName streaks_uri -var STREAKS
     593    book getword magicDSToRevert $pageName stage -var STAGE
     594    book getword magicDSToRevert $pageName stage_id -var STAGE_ID
     595    book getword magicDSToRevert $pageName component -var COMPONENT
     596    book getword magicDSToRevert $pageName uri -var URI
     597    book getword magicDSToRevert $pageName path_base -var PATH_BASE
     598    book getword magicDSToRevert $pageName inverse -var INVERSE
     599    book getword magicDSToRevert $pageName cam_path_base -var CAM_PATH_BASE
     600    book getword magicDSToRevert $pageName outroot -var OUTROOT
     601    book getword magicDSToRevert $pageName recoveryroot -var RECROOT
     602    book getword magicDSToRevert $pageName re_place -var REPLACE
     603    book getword magicDSToRevert $pageName dbname -var DBNAME
     604
     605    sprintf logfile "%s/%s.mds.%s.%s.%s.log" $OUTROOT $EXP_ID $MAGIC_DS_ID $STAGE_ID $COMPONENT
     606
     607    host anyhost
     608
     609    # TODO: do not add recoveryroot or replace if they are null or zero
     610
     611    $run = magic_destreak_revert.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
     612    if ("$INVERSE" == "T")
     613       # Inverse subtraction
     614       $run = $run --inverse
     615    end
     616
     617    add_standard_args run
     618
     619    # save the pageName for future reference below
     620    options $pageName
     621
     622    # create the command line
     623    if ($VERBOSE > 1)
     624      echo command $run
     625    end
     626    command $run
     627  end
     628
     629  # default exit status
     630  task.exit    0
     631    process_exit magicDSToRevert $options:0 $JOB_STATUS
     632   end
     633
     634  # locked list
     635  task.exit    default
     636    showcommand failure
     637    process_exit magicDSToRevert $options:0 $JOB_STATUS
     638  end
     639
     640  task.exit    crash
     641    showcommand crash
     642    book setword magicDSToRevert $options:0 pantaskState CRASH
     643  end
     644
     645  # operation timed out?
     646  task.exit    timeout
     647    showcommand timeout
     648    book setword magicDSToRevert $options:0 pantaskState TIMEOUT
     649  end
     650end
     651
Note: See TracChangeset for help on using the changeset viewer.