IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 30, 2006, 12:27:01 PM (20 years ago)
Author:
eugene
Message:

basic detrend stages work

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippTasks/detrend.resid.pro

    r8691 r9081  
    1313## the DetrendResidImfiles queue contains:
    1414## STATE ITER TYPE DET_ID EXP_KEY CLASS_ID URI_IN
     15
     16queueinit DetrendResidImfiles
     17queueinit DetrendResidExp
     18if ($?network == 0)
     19  $network = 1
     20end
     21if ($?parallel == 0)
     22  $parallel = 0
     23end
    1524
    1625# select images ready for copy
     
    2332  periods      -poll 1
    2433  periods      -exec 5
    25   periods      -timeout 30
     34  periods      -timeout 5
     35
     36  stdout dettool.resid.log
     37  stderr dettool.resid.log
    2638
    2739  # success
     
    3850      list word -split $line
    3951      $ITER     = $word:0
    40       $TYPE    = $word:1
     52      $DET_TYPE = $word:1
    4153      $DET_ID   = $word:2
    4254      $EXP_KEY  = $word:3
    4355      $CLASS_ID = $word:4
    4456      $URI_IN   = $word:5
    45       queuepush DetrendResidImfiles -uniq -key 1:3:4:5 "NEW $ITER $TYPE $DET_ID $EXP_KEY $CLASS_ID $URI_IN"
     57      ## XXX need to include the detID and iter in the key (if we have two running at the same time...)
     58      ## Also needed to be in the output file (or path)
     59      queuepush DetrendResidImfiles -uniq -key 1:3:4:5 "NEW $ITER $DET_TYPE $DET_ID $EXP_KEY $CLASS_ID $URI_IN"
    4660    end
    4761
     
    6983task           dettool.resid.process
    7084  periods      -poll 0.5
    71   periods      -exec 1.0
    72   periods      -timeout 5
     85  periods      -exec 5.0
     86  periods      -timeout 15
    7387
    7488  task.exec
     
    90104    ## NOTE: the queue has the STATE prepended
    91105    list word -split $line
    92     $ITER     = $word:1
    93     $TYPE     = $word:2
    94     $DET_ID   = $word:3
    95     $EXP_KEY  = $word:4
    96     $CLASS_ID = $word:5
    97     $URI_IN   = $word:6
     106    $ITER     = $word:0
     107    $DET_TYPE = $word:1
     108    $DET_ID   = $word:2
     109    $EXP_KEY  = $word:3
     110    $CLASS_ID = $word:4
     111    $URI_IN   = $word:5
     112
     113    stdout $EXP_KEY.detresid.$DET_ID.$ITER.$CLASS_ID.log
     114    stderr $EXP_KEY.detresid.$DET_ID.$ITER.$CLASS_ID.log
    98115
    99116    # specify choice of remote host:
    100     host anyhost
     117    if ($parallel)
     118      host anyhost
     119    else
     120      host local
     121    end
    101122
    102123    # create example job options as a demonstration
    103124    options "$line"
    104125    # detrend_create_resid.pl DET_ID ITER EXP_KEY CLASS_ID TYPE (URI-DET) (URL-IN) (EXP_KEY ???)
    105     $URL_DET = $TYPE\_$CLASS_ID\_$DET_ID\_$ITER.fit
    106     command detrend_create_resid.pl $DET_ID $ITER $EXP_KEY $CLASS_ID $TYPE $URI_DET $URL_IN $EXP_KEY
     126    $URL_DET = isp.$DET_TYPE.$DET_ID.$ITER.$CLASS_ID.fits
     127    # $URL_DET = $CAMERA.$DET_TYPE.$DET_ID.$ITER.$CLASS_ID.fits
     128    echo command detrend_create_resid.pl --det_id $DET_ID --iteration $ITER --exp_id $EXP_KEY --class_id $CLASS_ID --det_type $DET_TYPE --detrend $URL_DET --input_uri $URI_IN
     129    command detrend_create_resid.pl --det_id $DET_ID --iteration $ITER --exp_id $EXP_KEY --class_id $CLASS_ID --det_type $DET_TYPE --detrend $URL_DET --input_uri $URI_IN
    107130  end
    108131
     
    119142  # operation times out?
    120143  task.exit    timeout
    121     queuepush DetrendResidImfiles -replace -key 1:3:4:5 "FAIL $options:0"
    122   end
    123 end
     144    queuepush DetrendResidImfiles -replace -key 1:3:4:5 "TIMEOUT $options:0"
     145  end
     146end
     147
     148# select images ready for copy
     149# new entries are added to queue DetrendResidExp
     150# compare the new list with the ones already selected
     151task           dettool.residexp.load
     152  command      dettool -toresidexp -simple
     153  host         local
     154
     155  periods      -poll 1
     156  periods      -exec 5
     157  periods      -timeout 5
     158
     159  stdout dettool.residexp.log
     160  stderr dettool.residexp.log
     161
     162  # success
     163  task.exit    0
     164    # XXX is it necessary for these to be local?
     165    # drop after this task macro is done?
     166    local i Nqueue
     167
     168    # compare output with newImage queue
     169    # only add entries which don't exist in queue
     170    queuesize stdout -var Nqueue
     171    for i 0 $Nqueue
     172      queuepop stdout -var line
     173      list word -split $line
     174      $DET_ID   = $word:0
     175      $ITER     = $word:1
     176      $DET_TYPE = $word:2
     177      $EXP_KEY  = $word:3
     178      $INCLUDE  = $word:4
     179      queuepush DetrendResidExp -uniq -key 1:2:4 "NEW $DET_ID $ITER $DET_TYPE $EXP_KEY $INCLUDE"
     180    end
     181
     182    # delete existing entries which are DONE
     183    queuedrop DetrendResidExp -key 0 DONE
     184  end
     185
     186  # locked list
     187  task.exit    1
     188    echo       "new.images: exec failure"
     189  end
     190
     191  # default exit status
     192  task.exit    default
     193    echo       "new.images: unknown exit status: $EXIT"
     194  end
     195
     196  # operation times out?
     197  task.exit    timeout
     198    echo       "new.images: timeout"
     199  end
     200end
     201
     202# copy new images, sending job to desired host
     203task           dettool.residexp.process
     204  periods      -poll 0.5
     205  periods      -exec 5.0
     206  periods      -timeout 15
     207
     208  task.exec
     209    queuesize DetrendResidExp -var N
     210    if ($N == 0) break
     211    if ($network == 0) break
     212   
     213    # look for new images on the internal DetrendResidExp queue
     214    # caution with these 'if' statements: syntax errors
     215    # will make the task fail without given a good status
     216    queuepop DetrendResidExp -var line -key 0 NEW
     217    if ("$line" == "NULL") break
     218
     219    strpop line state
     220    queuepush DetrendResidExp -replace -key 1:2:4 "RUN $line"
     221
     222    ## the DetrendResidExp queue contains:
     223    ## STATE ITER TYPE DET_ID EXP_KEY CLASS_ID URI_IN
     224    ## NOTE: the queue has the STATE prepended
     225    list word -split $line
     226    $DET_ID   = $word:0
     227    $ITER     = $word:1
     228    $DET_TYPE = $word:2
     229    $EXP_KEY  = $word:3
     230    $INCLUDE  = $word:4
     231
     232    stdout $EXP_KEY.detresid.$DET_ID.$ITER.log
     233    stderr $EXP_KEY.detresid.$DET_ID.$ITER.log
     234
     235    # specify choice of remote host:
     236    if ($parallel)
     237      host anyhost
     238    else
     239      host local
     240    end
     241
     242    # create example job options as a demonstration
     243    options "$line"
     244    echo command detrend_reject_imfile.pl --det_id $DET_ID --iteration $ITER --exp_id $EXP_KEY --det_type $DET_TYPE
     245    command detrend_reject_imfile.pl --det_id $DET_ID --iteration $ITER --exp_id $EXP_KEY --det_type $DET_TYPE
     246  end
     247
     248  # success
     249  task.exit 0
     250    queuepush DetrendResidExp -replace -key 1:2:4 "DONE $options:0"
     251  end
     252
     253  # default exit status
     254  task.exit    default
     255    queuepush DetrendResidExp -replace -key 1:2:4 "FAIL $options:0"
     256  end
     257
     258  # operation times out?
     259  task.exit    timeout
     260    queuepush DetrendResidExp -replace -key 1:2:4 "TIMEOUT $options:0"
     261  end
     262end
Note: See TracChangeset for help on using the changeset viewer.