IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 10416


Ignore:
Timestamp:
Dec 1, 2006, 5:19:23 PM (19 years ago)
Author:
jhoblitt
Message:

complete implementation (mostly working)

File:
1 edited

Legend:

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

    r10067 r10416  
    11## PanTasks scripts for Summit Copy
     2
     3$uri        = http://otis/ds/skyprobe/
     4$camera     = skyprobe
     5$telescope  = ps1
     6$workdir    = /home/moanui/jhoblitt/workdir
    27
    38if ($?parallel == 0)
     
    914# queue for summit imfiles that need to be downloaded
    1015queueinit pzPendingImfile
     16# queue for downloaded files that need to registered with pztool -copydone
     17queueinit pzCopyDone
    1118
    1219# run pzgetexp periodically to populate pzPendingExp
    1320task pzgetexp
    14   command      pzgetexp -uri http://otis/ds/skyprobe/ -inst skyprobe -telescope ps1
     21  command      pzgetexp -uri $uri -inst $camera -telescope $telescope
    1522  host         local
    1623
     
    4754        for i 0 $Nstdout
    4855            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"
     56#            list word -split $line
     57#            $exp_id     = $word:0
     58#            $camera     = $word:1
     59#            $telescope  = $word:2
     60#            $dateobs    = $word:3
     61#            $exp_type   = $word:4
     62#            $uri        = $word:5
     63#            $imfiles    = $word:6
     64#            queuepush pzPendingExp -uniq -key 1:2:3 "NEW $uri $exp_id $camera $telescope $dateobs $exp_type $uri $imfiles"
     65            queuepush pzPendingExp -uniq -key 1:2:3 "NEW $line"
    5866        end
    5967
     
    7179# run pzgetimfiles on pending exps
    7280task pzgetimfile
    73     periods      -exec     30
    74     periods      -poll     10
    75     periods      -timeout  30
     81    periods      -exec     5
     82    periods      -poll     5
     83    periods      -timeout  15
    7684
    7785    task.exec
     
    99107
    100108        # specify choice of remote host:(need to choose based on chips)
    101         if ($parallel)
    102             host anyhost
    103         else
    104             host local
    105         end
     109#        if ($parallel)
     110#            host anyhost
     111#        else
     112#            host local
     113#        end
    106114       
    107115        # store the current line
    108116        options "$line"
    109117
    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
     118        echo command pzgetimfiles -uri $uri -filesetid $exp_id -inst $camera -telescope $telescope
     119        command pzgetimfiles -uri $uri -filesetid $exp_id -inst $camera -telescope $telescope
    112120    end
    113121
     
    151159            $class_id   = $word:6
    152160            $uri        = $word:7
    153             queuepush pzPendingImfile -uniq -key 1:2:3:6:7 "NEW $exp_id $camera $telescope $bytes $md5sum $class $class_id $uri"
     161
     162            queuepush pzPendingImfile -uniq -key 1:2:3:6:7 "NEW $line"
    154163        end
    155164
     
    165174    end
    166175end
     176
     177# get dsget to retreive an imfile and then call pztool -copydone
     178task dsget
     179    periods      -exec     5
     180    periods      -poll     5
     181    periods      -timeout  30
     182
     183    task.exec
     184        queuesize pzPendingImfile -var N
     185        if ($N == 0) break
     186
     187        # get a line out of the queue
     188        queuepop pzPendingImfile -var line -key 0 NEW
     189
     190        # take the state out of the line
     191        strpop line state
     192
     193        # put the line back into the queue with a stea of RUN
     194        queuepush pzPendingImfile -replace -key 1:2:3:6:7 "RUN $line"
     195
     196        # the STATE has already been removed from the line
     197        list word -split $line
     198        $exp_id     = $word:0
     199        $camera     = $word:1
     200        $telescope  = $word:2
     201        $bytes      = $word:3
     202        $md5sum     = $word:4
     203        $class      = $word:5
     204        $class_id   = $word:6
     205        $uri        = $word:7
     206
     207#        # specify choice of remote host:(need to choose based on chips)
     208#        if ($parallel)
     209#            host anyhost
     210#        else
     211#            host local
     212#        end
     213       
     214        # store the current line without the state
     215        options "$line"
     216
     217        echo "parsing line $line"
     218        echo command dsget --uri $uri --filename $workdir/$exp_id.$class_id.fits --bytes $bytes --md5 $md5sum
     219        command dsget --uri $uri --filename $workdir/$exp_id.$class_id.fits --bytes $bytes --md5 $md5sum
     220    end
     221
     222    # success
     223    task.exit 0
     224        # could run copydone from here but how would the exit status be
     225        # handled?
     226
     227        list word -split $line
     228        $exp_id     = $word:0
     229        $camera     = $word:1
     230        $telescope  = $word:2
     231        $bytes      = $word:3
     232        $md5sum     = $word:4
     233        $class      = $word:5
     234        $class_id   = $word:6
     235        $uri        = $word:7
     236        queuepush pzCopyDone -key 1:2:3:6:7 "NEW $exp_id $camera $telescope $bytes $md5sum $class $class_id $workdir/$exp_id.$class_id.fits"
     237        queuepush pzPendingExp -replace -key 1:2:3:6:7 "DONE $options:0"
     238    end
     239
     240    task.exit default
     241        queuepush pzPendingExp -replace -key 1:2:3:6:7 "FAIL $options:0"
     242    end
     243
     244    task.exit timeout
     245        queuepush pzPendingExp -replace -key 1:2:3:6:7 "TIMEOUT $options:0"
     246    end
     247end
     248
     249task pztool.copydone
     250    periods      -exec     5
     251    periods      -poll     5
     252    periods      -timeout  15
     253
     254    host local
     255
     256    task.exec
     257        queuesize pzCopyDone -var N
     258        if ($N == 0) break
     259
     260        # get a line out of the queue
     261        queuepop pzCopyDone -var line -key 0 NEW
     262
     263        # take the state out of the line
     264        strpop line state
     265
     266        # put the line back into the queue with a stea of RUN
     267        queuepush pzCopyDone -replace -key 1:2:3:6:7 "RUN $line"
     268
     269        # the STATE has already been removed from the line
     270        list word -split $line
     271        $exp_id     = $word:0
     272        $camera     = $word:1
     273        $telescope  = $word:2
     274        $bytes      = $word:3
     275        $md5sum     = $word:4
     276        $class      = $word:5
     277        $class_id   = $word:6
     278        $uri        = $word:7
     279
     280        # store the current line without the state
     281        options "$line"
     282
     283        local cmd
     284        $cmd = pztool -copydone -exp_id $exp_id -inst $camera -telescope $telescope -class $class -class_id $class_id -uri $uri
     285        echo command $cmd
     286        command $cmd
     287    end
     288
     289    # success
     290    task.exit 0
     291        queuepush pzCopyDone -replace -key 1:2:3:6:7 "DONE $options:0"
     292    end
     293
     294    task.exit default
     295        queuepush pzCopyDone -replace -key 1:2:3:6:7 "FAIL $options:0"
     296    end
     297
     298    task.exit timeout
     299        queuepush pzCopyDone -replace -key 1:2:3:6:7 "TIMEOUT $options:0"
     300    end
     301end
Note: See TracChangeset for help on using the changeset viewer.