IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 16, 2010, 5:30:27 PM (16 years ago)
Author:
watersc1
Message:

merge of stack association and warp/stack/diff jpegs

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/ippTasks/diff.pro

    r27920 r28375  
    1111book init diffSkyfile
    1212#book init diffCleanup
     13book init diffPendingSummary
    1314
    1415### Database lists
     
    1617$diffAdvance_DB = 0
    1718$diff_revert_DB = 0
     19$diffSummary_DB = 0
    1820#$diffCleanup_DB = 0
    1921
     
    2729macro diff.reset
    2830  book init diffSkyfile
     31  book init diffPendingSummary
    2932#  book init diffCleanup
    3033end
     
    4447    active false
    4548  end
     49  task diff.summary.load
     50    active true
     51  end
     52  task diff.summary.run
     53    active true
     54  end
    4655end
    4756
     
    5867  end
    5968  task diff.revert
     69    active false
     70  end
     71  task diff.summary.load
     72    active false
     73  end
     74  task diff.summary.run
    6075    active false
    6176  end
     
    193208    # host anyhost
    194209    # $WORKDIR = $WORKDIR_TEMPLATE
    195 
    196210    if (($DIFF_MODE == 1)||("$DIFF_MODE" == "NULL"))
    197211        $DIFF_TAG = ""
     
    477491  end
    478492end
     493
     494### Load tasks for doing the diffs
     495### Tasks are loaded into diffPendingSkyCell.
     496task           diff.summary.load
     497  host         local
     498
     499  periods      -poll $LOADPOLL
     500  periods      -exec $LOADEXEC
     501  periods      -timeout 1200
     502  npending     1
     503
     504  stdout NULL
     505  stderr $LOGDIR/diff.summary.log
     506
     507  task.exec
     508    if ($LABEL:n == 0) break
     509    $run = difftool -tosummary
     510    if ($DB:n == 0)
     511      option DEFAULT
     512    else
     513      # save the DB name for the exit tasks
     514      option $DB:$diffSummary_DB
     515      $run = $run -dbname $DB:$diffSummary_DB
     516      $diffSummary_DB ++
     517      if ($diffSummary_DB >= $DB:n) set diffSummary_DB = 0
     518    end
     519    add_poll_args run
     520    add_poll_labels run
     521    command $run
     522  end
     523
     524  # success
     525  task.exit    0
     526    # convert 'stdout' to book format
     527    # XXX change tess_id to tess_dir when db is updated
     528    ipptool2book stdout diffPendingSummary -key diff_id -uniq -setword dbname $options:0 -setword pantaskState INIT
     529    if ($VERBOSE > 2)
     530      book listbook diffPendingSummary
     531    end
     532
     533    # delete existing entries in the appropriate pantaskStates
     534    process_cleanup diffPendingSummary
     535  end
     536
     537  # locked list
     538  task.exit    default
     539    showcommand failure
     540  end
     541
     542  task.exit    crash
     543    showcommand crash
     544  end
     545
     546  # operation times out?
     547  task.exit    timeout
     548    showcommand timeout
     549  end
     550end
     551
     552### Run tasks for calculating the diff overlaps
     553### Tasks are taken from diffPendingSkyCell.
     554task           diff.summary.run
     555  periods      -poll $RUNPOLL
     556  periods      -exec $RUNEXEC
     557  periods      -timeout 60
     558
     559  task.exec
     560    # if we are unable to run the 'exec', use a long retry time
     561    periods -exec $RUNEXEC
     562
     563    book npages diffPendingSummary -var N
     564    if ($N == 0) break
     565    if ($NETWORK == 0) break
     566   
     567    # look for new images in diffPendingSkyCell (pantaskState == INIT)
     568    book getpage diffPendingSummary 0 -var pageName -key pantaskState INIT
     569    if ("$pageName" == "NULL") break
     570
     571    book setword diffPendingSummary $pageName pantaskState RUN
     572    book getword diffPendingSummary $pageName diff_id -var DIFF_ID
     573    book getword diffPendingSummary $pageName camera -var CAMERA
     574    book getword diffPendingSummary $pageName workdir -var WORKDIR_TEMPLATE
     575    book getword diffPendingSummary $pageName dbname -var DBNAME
     576    book getword diffPendingSummary $pageName tess_id -var TESS_DIR
     577    book getword diffPendingSummary $pageName diff_mode -var DIFF_MODE
     578    book getword diffPendingSummary $pageName state -var RUN_STATE
     579
     580    # set the host and workdir based on the skycell hash
     581    host anyhost
     582    strsub $WORKDIR_TEMPLATE @HOST@.0 $default_host -var WORKDIR
     583#    set.workdir.by.skycell $SKYCELL_ID $WORKDIR_TEMPLATE $default_host WORKDIR
     584
     585#    if ("$PATH_BASE" == "NULL")
     586
     587    if (($DIFF_MODE == 1)||("$DIFF_MODE" == "NULL"))
     588        $DIFF_TAG = ""
     589    end
     590    if ($DIFF_MODE == 2)
     591        $DIFF_TAG = "WS."
     592    end
     593    if ($DIFF_MODE == 3)
     594        $DIFF_TAG = "SW."
     595    end
     596    if ($DIFF_MODE == 4)
     597        $DIFF_TAG = "SS."
     598    end
     599
     600    basename $TESS_DIR -var TESS_ID
     601
     602    ## generate outroot specific to this exposure
     603    sprintf outroot "%s/%s/%s.%sdif.%s.summary" $WORKDIR $TESS_ID $TESS_ID $DIFF_TAG $DIFF_ID
     604
     605
     606    stdout $LOGDIR/diff.summary.log
     607    stderr $LOGDIR/diff.summary.log
     608
     609    $run = skycell_jpeg.pl --stage diff --stage_id $DIFF_ID --camera $CAMERA --outroot $outroot
     610    add_standard_args run
     611
     612    # save the pageName for future reference below
     613    options $pageName
     614
     615    # create the command line
     616    if ($VERBOSE > 1)
     617      echo command $run
     618    end
     619    periods -exec 0.05
     620    command $run
     621  end
     622
     623  # default exit status
     624  task.exit    default
     625    process_exit diffPendingSummary $options:0 $JOB_STATUS
     626  end
     627
     628  # locked list
     629  task.exit    crash
     630    showcommand crash
     631    echo "hostname: $JOB_HOSTNAME"
     632    book setword diffPendingSummary $options:0 pantaskState CRASH
     633  end
     634
     635  # operation timed out?
     636  task.exit    timeout
     637    showcommand timeout
     638    book setword diffPendingSummary $options:0 pantaskState TIMEOUT
     639  end
     640end
Note: See TracChangeset for help on using the changeset viewer.