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/phase2.pro

    r10758 r11210  
    11## this file contains the tasks for running the phase 0 stage
     2## these tasks use the book p2PendingImfile
    23
    3 ## these tasks use the queue Phase2Imfiles
    4 ## the Phase2Imfiles queue contains:
    5 ## STATE EXP_TAG CLASS CLASS_ID URI-FITS
    6 ## queue keys are counted from 0
    7 
    8 queueinit Phase2Imfiles
    94if ($?network == 0)
    105  $network = 1
     
    138  $parallel = 0
    149end
    15 
    16 $Phase2ImfileFail = 0
    17 
    1810if ($?VERBOSE == 0)
    1911  echo "VERBOSE not defined: load pantasks.pro first"
     
    2416  break
    2517end
     18
    2619$LOGSUBDIR = $LOGDIR/phase2
    2720exec mkdir -p $LOGSUBDIR
    2821
     22book init p2PendingImfile
     23
    2924macro phase2.status
    30   queueprint Phase2Imfiles
    31   echo "Phase2ImfileFail: $Phase2ImfileFail"
     25  book listbook p2PendingImfile
    3226end
    3327
    3428# select images ready for phase2 analysis
    35 # new entries are added to queue Phase2Imfiles
    36 # compare the new list with the ones already selected
     29# new entries are added to p2PendingImfile
     30# skip already-present entries
    3731task           phase2.imfile.load
    3832  host         local
     
    4236  periods      -timeout 30
    4337
    44   stdout $LOGSUBDIR/phase2.imfile.log
     38  stdout NULL
    4539  stderr $LOGSUBDIR/phase2.imfile.log
    4640
    4741  task.exec
    48     # command p2tool -pendingimfile -simple -limit {$Phase2ImfileFail + 20}
    49     command p2tool -pendingimfile -simple
     42    command p2tool -pendingimfile -limit 20
    5043  end
    5144
    5245  # success
    5346  task.exit    0
    54     local i Nqueue
    55 
    56     # save stdout and stderr
    57 
    58     # compare output with Phase2Imfiles queue
    59     # only add entries which don't exist in queue
    60     queuesize stdout -var Nqueue
    61     for i 0 $Nqueue
    62       queuepop stdout -var line
    63       if ($VERBOSE > 2)
    64         echo $line
    65       end
    66       list word -split $line
    67       $EXP_TAG  = $word:0
    68       $CLASS_ID = $word:1
    69       $URI      = $word:2
    70       queuepush Phase2Imfiles -uniq -key 1:2 "NEW $EXP_TAG $CLASS_ID $URI"
     47    # convert 'stdout' to book format
     48    ipptool2book stdout p2PendingImfile -key exp_tag:class_id -uniq
     49    if ($VERBOSE > 2)
     50      book listbook p2PendingImfile
    7151    end
    7252
    7353    # delete existing entries which are DONE
    74     queuedrop Phase2Imfiles -key 0 DONE
     54    book delpage p2PendingImfile -key state DONE
    7555  end
    7656
     
    8666end
    8767
    88 # run the phase2imfile script on pending images
     68# run the phase2.pl script on pending images
    8969task           phase2.imfile.run
    9070  periods      -poll $runpoll
     
    9373
    9474  task.exec
    95     queuesize Phase2Imfiles -var N
     75    book npages p2PendingImfile -var N
    9676    if ($N == 0) break
    9777    if ($network == 0) break
    9878   
    99     # look for new images on the internal DetrendImfilesToProcess queue
    100     # caution with these 'if' statements: syntax errors
    101     # will make the task fail without given a good status
    102     queuepop Phase2Imfiles -var line -key 0 NEW
    103     if ("$line" == "NULL") break
     79    # look for new images in p2PendingImfile (state == NULL)
     80    book getpage p2PendingImfile 0 -var pageName -key state NULL
     81    if ($pageName == NULL) break
    10482
    105     strpop line state
    106     queuepush Phase2Imfiles -replace -key 1:2 "RUN $line"
     83    book setword p2PendingImfile $pageName state RUN
     84    book getword p2PendingImfile $pageName camera -var CAMERA
     85    book getword p2PendingImfile $pageName exp_tag -var EXP_TAG
     86    book getword p2PendingImfile $pageName outpath -var OUTPATH
     87    book getword p2PendingImfile $pageName class_id -var CLASS_ID
     88    book getword p2PendingImfile $pageName uri -var URI
    10789
    108     ## the Phase2Imfiles queue contains (line has popped STATE)
    109     ## STATE EXP_TAG CLASS CLASS_ID URI-FITS
    110     list word -split $line
    111     $EXP_TAG  = $word:0
    112     $CLASS_ID = $word:1
    113     $URI      = $word:2
    114 
    115     # specify choice of remote host:(need to choose based on chips)
     90    # specify choice of remote host
     91    # XXX need to choose based on chips
    11692    if ($parallel)
    11793      host anyhost
     
    12096    end
    12197
    122     ## add 'p2' to the log files?
    123     # XXX this is still a lame rule
    124     $word = `basename $EXP_TAG | tr '.' ' '`
    125     list word -split $word
    126     $base = $word:0
    127     stdout $LOGSUBDIR/$base/$EXP_TAG.$CLASS_ID.log
    128     stderr $LOGSUBDIR/$base/$EXP_TAG.$CLASS_ID.log
    129     exec mkdir -p $LOGSUBDIR/$base
     98    ## generate output log based on filerule
     99    $outroot = $OUTPATH/$EXP_TAG
     100    $logfile = `ipp_filename.pl PHASE2.LOG $outroot $CLASS_ID`
     101    stdout $logfile
     102    stderr $logfile
     103    exec mkdir -p $OUTPATH
     104
     105    # save the pageName for future reference below
     106    options $pageName
    130107
    131108    # create the command line
    132     options "$line"
    133109    if ($VERBOSE > 1)
    134       echo command phase2.pl --exp_tag $EXP_TAG --class_id $CLASS_ID --uri $URI
     110      echo command phase2.pl --exp_tag $EXP_TAG --class_id $CLASS_ID --uri $URI --camera $CAMERA
    135111    end
    136     ## XXX this is annoying: phase2.pl now requires camera :: it should not need this, it has the file.
    137     command phase2.pl --exp_tag $EXP_TAG --class_id $CLASS_ID --uri $URI --camera CTIO_MOSAIC2
    138   end
    139 
    140   # success
    141   task.exit 0
    142     # phase2imfile.pl updates DB tables, here we just update the queue
    143     queuepush Phase2Imfiles -replace -key 1:2 "DONE $options:0"
     112    command phase2.pl --exp_tag $EXP_TAG --class_id $CLASS_ID --uri $URI --camera $CAMERA --outpath $OUTPATH
    144113  end
    145114
    146115  # default exit status
    147116  task.exit    default
    148     showcommand failure
    149     queuepush Phase2Imfiles -replace -key 1:2 "FAIL $options:0"
    150     $Phase2ImfileFail ++
     117    process_exit p2PendingImfile $options:0 $JOB_STATUS
    151118  end
    152119
    153   # operation times out?
     120  # operation timed out?
    154121  task.exit    timeout
    155122    showcommand timeout
    156     queuepush Phase2Imfiles -replace -key 1:2 "TIMEOUT $options:0"
    157     $Phase2ImfileFail ++
     123    book setword p2PendingImfile $options:0 state TIMEOUT
    158124  end
    159125end
Note: See TracChangeset for help on using the changeset viewer.