IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 19, 2007, 5:24:59 PM (19 years ago)
Author:
eugene
Message:

converting to book version

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippTasks/phase3.pro

    r10758 r11210  
    1 ## this file contains the tasks for running the phase 0 stage
     1## this file contains the tasks for running the phase 3 stage
     2## these tasks use the book p3PendingExp
    23
    3 ## these tasks use the queue Phase3Exposures
    4 ## the Phase3Exposures queue contains:
    5 ## STATE EXP_TAG CLASS CLASS_ID URI-FITS
    6 ## queue keys are counted from 0
    7 
    8 queueinit Phase3Exposures
    94if ($?network == 0)
    105  $network = 1
     
    138  $parallel = 0
    149end
    15 
    16 $Phase3ExposureFail = 0
    17 
    1810if ($?VERBOSE == 0)
    1911  echo "VERBOSE not defined: load pantasks.pro first"
     
    2416  break
    2517end
     18
    2619$LOGSUBDIR = $LOGDIR/phase3
    2720exec mkdir -p $LOGSUBDIR
    2821
     22book init p3PendingExp
     23
    2924macro phase3.status
    30   queueprint Phase3Exposures
    31   echo "Phase3ExposureFail: $Phase3ExposureFail"
     25  book listbook p3PendingExp
    3226end
    3327
    3428# select images ready for phase3 analysis
    35 # new entries are added to queue Phase3Exposures
    36 # compare the new list with the ones already selected
     29# new entries are added to p3PendingExp
     30# skip already-present entries
    3731task           phase3.exp.load
    3832  host         local
     
    4640
    4741  task.exec
    48     command      p3tool -pendingexp -simple
     42    command p3tool -pendingexp -limit 20
    4943  end
    5044
    5145  # success
    5246  task.exit    0
    53     local i Nqueue
    54 
    55     # compare output with Phase3Exposures queue
    56     # only add entries which don't exist in queue
    57     queuesize stdout -var Nqueue
    58     for i 0 $Nqueue
    59       queuepop stdout -var line
    60       if ($VERBOSE > 2)
    61         echo $line
    62       end
    63       list word -split $line
    64       $EXP_TAG   = $word:0
    65       queuepush Phase3Exposures -uniq -key 1 "NEW $EXP_TAG"
     47    # convert 'stdout' to book format
     48    ipptool2book stdout p3PendingExp -key exp_tag -uniq
     49    if ($VERBOSE > 2)
     50      book listbook p3PendingExp
    6651    end
    6752
    6853    # delete existing entries which are DONE
    69     queuedrop Phase3Exposures -key 0 DONE
     54    book delpage p3PendingExp -key state DONE
    7055  end
    7156
     
    8873
    8974  task.exec
    90     queuesize Phase3Exposures -var N
     75    book npages p3PendingExp -var N
    9176    if ($N == 0) break
    9277    if ($network == 0) break
    9378   
    94     # look for new images on the internal DetrendExposuresToProcess queue
    95     # caution with these 'if' statements: syntax errors
    96     # will make the task fail without given a good status
    97     queuepop Phase3Exposures -var line -key 0 NEW
    98     if ("$line" == "NULL") break
     79    # look for new images in p3PendingExp (state == NULL)
     80    book getpage p3PendingExp 0 -var pageName -key state NULL
     81    if ($pageName == NULL) break
    9982
    100     strpop line state
    101     queuepush Phase3Exposures -replace -key 1 "RUN $line"
     83    book setword p3PendingExp $pageName state RUN
     84    book getword p3PendingExp $pageName camera -var CAMERA
     85    book getword p3PendingExp $pageName exp_tag -var EXP_TAG
    10286
    103     ## the Phase3Exposures queue contains:
    104     ## STATE EXP_TAG CAMERA TELESCOPE TYPE NCLASS
    105     list word -split $line
    106     $EXP_TAG   = $word:0
     87    # specify choice of remote host:(need to choose based on chips)
     88    if ($parallel)
     89      host anyhost
     90    else
     91      host local
     92    end
    10793
    10894    # XXX this is still a lame rule
     
    114100    exec mkdir -p $LOGSUBDIR/$base
    115101
    116     # specify choice of remote host:(need to choose based on chips)
    117     if ($parallel)
    118       host anyhost
    119     else
    120       host local
    121     end
     102    # save the pageName for future reference below
     103    options $pageName
    122104
    123105    # create the command line
    124     options "$line"
    125106    if ($VERBOSE > 1)
    126107      echo command phase3.pl --exp_tag $EXP_TAG
    127108    end
    128     command phase3.pl --exp_tag $EXP_TAG --camera CTIO_MOSAIC2
     109    command phase3.pl --exp_tag $EXP_TAG --camera $CAMERA
    129110  end
    130111
    131112  # success
    132113  task.exit 0
    133     # phase3exp.pl updates DB tables, here we just update the queue
    134     queuepush Phase3Exposures -replace -key 1 "DONE $options:0"
     114    # phase3exp.pl updates DB tables, here we just update the page
     115    book setword p3PendingExp $options:0 state DONE
    135116  end
    136117
     
    138119  task.exit    default
    139120    showcommand failure
    140     queuepush Phase3Exposures -replace -key 1 "FAIL $options:0"
    141     $Phase3ExposureFail ++
     121    book setword p3PendingExp $options:0 state FAIL
    142122  end
    143123
     
    145125  task.exit    timeout
    146126    showcommand timeout
    147     queuepush Phase3Exposures -replace -key 1 "TIMEOUT $options:0"
    148     $Phase3ExposureFail ++
     127    book setword p3PendingExp $options:0 state TIMEOUT
    149128  end
    150129end
Note: See TracChangeset for help on using the changeset viewer.