IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 23497 for trunk/ippTasks


Ignore:
Timestamp:
Mar 24, 2009, 10:18:19 AM (17 years ago)
Author:
bills
Message:

advance exposures using load, run style so that the proper workdir
and end stage

File:
1 edited

Legend:

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

    r23232 r23497  
    2727# list of summit imfiles that need to be downloaded
    2828book init pzPendingImfile
     29# list of pzDownloadExps that have completed downloading
     30book init pzPendingAdvance
    2931
    3032macro copy.on
     
    5052      active true
    5153  end
     54  task summit.toadvance
     55      active true
     56  end
    5257  task summit.advance
    5358      active true
     
    7580  end
    7681  task pztool.clearfault
     82      active false
     83  end
     84  task summit.toadvance
    7785      active false
    7886  end
     
    8694$pztoolPendingExp_DB = 0
    8795$pztoolPendingImfile_DB = 0
     96$pztoolPendingAdvance_DB = 0
    8897$pztoolClearFault_DB = 0
    8998$pztoolAdvance_DB = 0;
     
    433442        stderr $LOGDIR/summit.copy.log
    434443
    435         $run = summit_copy.pl --uri $URI --filename $FILENAME --exp_name $EXP_NAME --inst $CAMERA --telescope $TELESCOPE --class $CLASS --class_id $CLASS_ID --bytes $BYTES --md5 $MD5SUM --end_stage reg --workdir $workdir --dbname $DBNAME --timeout 120 --verbose --copies 2
     444        $run = summit_copy.pl --uri $URI --filename $FILENAME --exp_name $EXP_NAME --inst $CAMERA --telescope $TELESCOPE --class $CLASS --class_id $CLASS_ID --bytes $BYTES --md5 $MD5SUM --dbname $DBNAME --timeout 120 --verbose --copies 2
    436445        if ($COMPRESS)
    437446            $run = $run --compress
     
    510519end
    511520
    512 # promote exposures for which all imfiles have been copied
    513 task           summit.advance
    514   host         local
    515 
    516   periods      -poll $LOADPOLL
    517   periods      -exec $LOADEXEC
    518   periods      -timeout 30
    519   npending     1
    520 
    521   stdout NULL
    522   stderr $LOGDIR/summit.advance.log
    523 
    524   task.exec
    525     $run = pztool -advance
    526     if ($DB:n == 0)
    527       option DEFAULT
    528     else
    529       # save the DB name for the exit tasks
    530       option $DB:$pztoolAdvance_DB
    531       $run = $run -dbname $DB:$pztoolAdvance_DB
    532       $pztoolAdvance_DB ++
    533       if ($pztoolAdvance_DB >= $DB:n) set pztoolAdvance_DB = 0
    534     end
    535     add_poll_args run
    536     command $run
    537   end
    538 
    539   # success
    540   task.exit    0
    541   end
    542 
    543   # locked list
    544   task.exit    default
    545     showcommand failure
    546   end
    547 
    548   task.exit    crash
    549     showcommand crash
    550   end
    551 
    552   # operation times out?
    553   task.exit    timeout
    554     showcommand timeout
    555   end
    556 end
    557 
     521# build a book of exposures that have completed downloading
     522task summit.toadvance
     523    host         local
     524
     525    periods      -exec     30
     526    periods      -poll      1
     527    periods      -timeout  120
     528    # trage       16:00 23:59
     529    # trage       00:00 04:00
     530    npending     1
     531
     532    # select entries from the current DB; cycle to the next DB, if it exists
     533    # iff the DB list is not set, use the value defined in .ipprc
     534    task.exec
     535      if ($DB:n == 0)
     536        option DEFAULT
     537        command pztool -toadvance -limit 40
     538      else
     539        # save the DB name for the exit tasks
     540        option $DB:$pztoolPendingAdvance_DB
     541        command pztool -toadvance -limit 60 -dbname $DB:$pztoolPendingAdvance_DB
     542        $pztoolPendingAdvance_DB ++
     543        if ($pztoolPendingAdvance_DB >= $DB:n) set pztoolPendingAdvance_DB = 0
     544      end
     545    end
     546 
     547    # success
     548    task.exit    0
     549        # convert 'stdout' to book format
     550        ipptool2book stdout pzPendingAdvance -key exp_name:camera:telescope -uniq -setword dbname $options:0 -setword pantaskState INIT
     551        book shuffle pzPendingAdvance
     552
     553        # delete existing entries in the appropriate pantaskStates
     554        process_cleanup pzPendingAdvance
     555    end
     556
     557    task.exit     default
     558        showcommand failure
     559    end
     560    task.exit     crash
     561        showcommand crash
     562    end
     563    task.exit     timeout
     564        showcommand timeout
     565    end
     566end
     567
     568task summit.advance
     569    periods      -exec     5
     570    periods      -poll     0.05
     571    periods      -timeout  650
     572    # trage       16:00 23:59
     573    # trage       00:00 04:00
     574
     575    task.exec
     576        if ($NETWORK == 0) break
     577
     578        # if we are waiting on data, make the interval long
     579        book npages pzPendingAdvance -var N
     580        if ($N == 0)
     581            periods -exec 20
     582            break
     583        end
     584        periods -exec 0.05
     585
     586        # find an exp that needs imfiles fetched
     587        book getpage pzPendingAdvance 0 -var pageName -key pantaskState INIT
     588        if ("$pageName" == "NULL") break
     589
     590        # set that exp to run
     591        book setword pzPendingAdvance $pageName pantaskState RUN
     592
     593        book getword pzPendingAdvance $pageName exp_name  -var EXP_NAME
     594        book getword pzPendingAdvance $pageName camera    -var CAMERA
     595        book getword pzPendingAdvance $pageName telescope -var TELESCOPE
     596        book getword pzPendingAdvance $pageName dbname    -var DBNAME
     597
     598        # 2007-08-30T05:09:59Z
     599        substr $DATEOBS 0 4 YEAR
     600        substr $DATEOBS 5 2 MONTH
     601        substr $DATEOBS 8 2 DAY
     602
     603        # we need to set the workdir based on 1) nebulous or not? 2) chip/host relationship
     604        # this function uses workdir_template, default_host, volume_template, volume_default,
     605        # it sets workdir and volume
     606        set.workdir.by.camera $CAMERA $CLASS_ID $workdir_template $default_host workdir_base
     607
     608        $workdir = $workdir_template/$CAMERA/$YEAR\$MONTH\$DAY
     609
     610        # workdir examples:
     611        # file://data/@HOST@.0/gpc1/20080130
     612        # neb://@HOST@.0/gpc1/20080130
     613
     614        stdout $LOGDIR/summit.advance.log
     615        stderr $LOGDIR/summit.advance.log
     616
     617        $run = pztool -advance -exp_name $EXP_NAME -inst $CAMERA -telescope $TELESCOPE -end_stage reg -workdir $workdir -dbname $DBNAME
     618
     619        # store the pageName for future reference below
     620        options $pageName
     621
     622        # create the command line
     623        if ($VERBOSE > 1)
     624          echo command $run
     625        end
     626        command $run
     627    end
     628
     629    # default exit status
     630    task.exit default
     631        process_exit pzPendingAdvance $options:0 $JOB_STATUS
     632    end
     633
     634    task.exit crash
     635        showcommand crash
     636        book setword pzPendingAdvance $options:0 pantaskState CRASH
     637    end
     638
     639    # operation timed out?
     640    task.exit timeout
     641        showcommand timeout
     642        book setword pzPendingAdvance $options:0 pantaskState TIMEOUT
     643    end
     644end
Note: See TracChangeset for help on using the changeset viewer.