IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 17, 2006, 4:36:34 PM (20 years ago)
Author:
jhoblitt
Message:

copied over from summit.copy.skyprobe.pro

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippTasks/summit.copy.pro

    r9357 r10067  
    1 
    21## PanTasks scripts for Summit Copy
    32
    4 # queues: expPending (expID) (URL) (type) (source)
     3if ($?parallel == 0)
     4  $parallel = 0
     5end
    56
    6 $LastExpID = ""
     7# queue for summit exps that need to be queried
     8queueinit pzPendingExp
     9# queue for summit imfiles that need to be downloaded
     10queueinit pzPendingImfile
    711
    8 # newImagesPending : search for images to be processed
    9 task           exp.pending
    10   command      getNewExposures $LastExpID
     12# run pzgetexp periodically to populate pzPendingExp
     13task pzgetexp
     14  command      pzgetexp -uri http://otis/ds/skyprobe/ -inst skyprobe -telescope ps1
    1115  host         local
    1216
    1317  # timeout shorter than exec so jobs do not build up
    14   periods      -exec     5
    15   periods      -poll     1
    16   periods      -timeout  4
     18  periods      -exec     30
     19  periods      -poll     10
     20  periods      -timeout  30
    1721
    18   # success
    19   task.exit    0
    20     local i Nstdout
    21     # keep only new, unique entries (URL is key)
    22     queuesize stdout -var Nstdout
    23     for i 0 $Nstdout
    24       queuepop stdout -var line
    25       queuepush expPending -uniq -key 0 "$line new"
    26     end
     22  task.exit     0
     23  end
    2724
    28     # extract last exposure in list
    29     list tmp -split $line
    30     $LastExpID = $tmp:0
     25  task.exit     default
     26    echo "phaseZ pzgetexp: failure"
     27  end
     28  task.exit     timeout
     29    echo "phaseZ pzgetexp: timeout"
    3130  end
    3231end
    3332
    34 # imfile.pending : get the list imfiles for each exposure
    35 task           imfile.pending
    36   periods      -exec 1
    37   periods      -timeout 10
     33# build a queue of exps/filesetids that need to be queried
     34task pztool.pendingexp
     35    command      pztool -pendingexp -simple
     36    host         local
    3837
    39   task.exec
    40     local Npending
    41     queuesize  expPending -var Npending
    42     if ($Npending == 0) break
     38    # timeout shorter than exec so jobs do not build up
     39    periods      -exec     30
     40    periods      -poll     10
     41    periods      -timeout  30
    4342
    44     queuepop expPending -var line -key 2 new
    45     if ("$line" == "NULL") break
     43    # success
     44    task.exit    0
     45        local i Nstdout
     46        queuesize stdout -var Nstdout
     47        for i 0 $Nstdout
     48            queuepop stdout -var line
     49            list word -split $line
     50            $exp_id     = $word:0
     51            $camera     = $word:1
     52            $telescope  = $word:2
     53            $dateobs    = $word:3
     54            $exp_type   = $word:4
     55            $uri        = $word:5
     56            $imfiles    = $word:6
     57            queuepush pzPendingExp -uniq -key 1:2:3 "NEW $uri $exp_id $camera $telescope $dateobs exp_type $uri $imfiles"
     58        end
    4659
    47     list tmp -split $line
    48     $URL    = $tmp:0
    49     $expID  = $tmp:1
    50     $type   = $tmp:2
    51     $camera = $tmp:3
    52     queuepush expPending "$expID $camera run"
     60        queuedrop pzPendingExp -key 0 DONE
     61    end
    5362
    54     host local
    55     command getNewImfiles $URL
    56   end
    57 
    58   # success
    59   task.exit    0
    60     local i Nstdout
    61     # keep only new, unique entries (URL is key)
    62     queuesize stdout -var Nstdout
    63     for i 0 $Nstdout
    64       queuepop stdout -var line
    65       queuepush imfilePending -uniq -key 0 "$line new"
     63    task.exit     default
     64        echo "phaseZ pending exp: failure"
    6665    end
    67   end
     66    task.exit     timeout
     67        echo "phaseZ pending exp: timeout"
     68    end
    6869end
    6970
    70 # imfile.download : submit download job to the appropriate node
    71 task           imfile.download
    72   periods      -exec 1
    73   periods      -timeout 10
     71# run pzgetimfiles on pending exps
     72task pzgetimfile
     73    periods      -exec     30
     74    periods      -poll     10
     75    periods      -timeout  30
    7476
    75   task.exec
    76     local Npending
    77     queuesize  imfilePending -var Npending
    78     if ($Npending == 0) break
     77    task.exec
     78        queuesize pzPendingExp -var N
     79        if ($N == 0) break
    7980
    80     queuepop imfilePending -var line -key 2 new
    81     if ("$line" == "NULL") break
     81        # get a line out of the queue
     82        queuepop pzPendingExp -var line -key 0 NEW
    8283
    83     list tmp -split $line
    84     $URL    = $tmp:0
    85     $expID  = $tmp:1
    86     $type   = $tmp:2
    87     $camera = $tmp:3
    88     queuepush imfilePending "$expID $camera run"
     84        # take the state out of the line
     85        strpop line state
    8986
    90     host local
    91     command copyImfile $URL
    92   end
     87        # put the line back into the queue with a stea of RUN
     88        queuepush pzPendingExp -replace -key 1:2:3 "RUN $line"
    9389
    94   # success
    95   task.exit    0
    96     local i Nstdout
    97     # keep only new, unique entries (URL is key)
    98     queuesize stdout -var Nstdout
    99     for i 0 $Nstdout
    100       queuepop stdout -var line
    101       queuepush imfilePending -uniq -key 0 "$line new"
     90        # the STATE has already been removed from the line
     91        list word -split $line
     92        $exp_id     = $word:0
     93        $camera     = $word:1
     94        $telescope  = $word:2
     95        $dateobs    = $word:3
     96        $exp_type   = $word:4
     97        $uri        = $word:5
     98        $imfiles    = $word:6
     99
     100        # specify choice of remote host:(need to choose based on chips)
     101        if ($parallel)
     102            host anyhost
     103        else
     104            host local
     105        end
     106       
     107        # store the current line
     108        options "$line"
     109
     110        echo command ./pzgetimfiles -uri $uri -filesetid $exp_id -inst $camera -telescope $telescope
     111        command ./pzgetimfiles -uri $uri -filesetid $exp_id -inst $camera -telescope $telescope
    102112    end
    103   end
     113
     114    # success
     115    task.exit 0
     116        queuepush pzPendingExp -replace -key 1:2:3 "DONE $options:0"
     117    end
     118
     119    task.exit default
     120        queuepush pzPendingExp -replace -key 1:2:3 "FAIL $options:0"
     121    end
     122
     123    task.exit timeout
     124        queuepush pzPendingExp -replace -key 1:2:3 "TIMEOUT $options:0"
     125    end
    104126end
     127
     128# build a queue of imfiles/files that need to be downloaded
     129task pztool.pendingimfile
     130    command      pztool -pendingimfile -simple
     131    host         local
     132
     133    # timeout shorter than exec so jobs do not build up
     134    periods      -exec     30
     135    periods      -poll     10
     136    periods      -timeout  30
     137
     138    # success
     139    task.exit    0
     140        local i Nstdout
     141        queuesize stdout -var Nstdout
     142        for i 0 $Nstdout
     143            queuepop stdout -var line
     144            list word -split $line
     145            $exp_id     = $word:0
     146            $camera     = $word:1
     147            $telescope  = $word:2
     148            $bytes      = $word:3
     149            $md5sum     = $word:4
     150            $class      = $word:5
     151            $class_id   = $word:6
     152            $uri        = $word:7
     153            queuepush pzPendingImfile -uniq -key 1:2:3:6:7 "NEW $exp_id $camera $telescope $bytes $md5sum $class $class_id $uri"
     154        end
     155
     156        # delete existing entries which are DONE
     157        queuedrop pzPendingImfile -key 0 DONE
     158    end
     159
     160    task.exit     default
     161        echo "phaseZ pending exp: failure"
     162    end
     163    task.exit     timeout
     164        echo "phaseZ pending exp: timeout"
     165    end
     166end
Note: See TracChangeset for help on using the changeset viewer.