IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 3, 2010, 5:46:26 PM (16 years ago)
Author:
watersc1
Message:

Realtime burntool code. Initial tests indicate it should work fine

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/czw_branch/20101203/ippTasks/register.pro

    r25418 r29908  
    88book init regPendingImfile
    99book init regPendingExp
     10book init regPendingBurntoolImfile
    1011
    1112macro register.reset
    1213  book init regPendingImfile
    1314  book init regPendingExp
     15  book init regPendingBurntoolImfile
    1416end
    1517
     
    1820  book listbook regPendingImfile
    1921  book listbook regPendingExp
     22  book listbook regPendingBurntoolImfile
    2023end
    2124
     
    3336    active true
    3437  end
     38  task register.burntool.load
     39    active true
     40  end
     41  task register.burntool.run
     42    active true
     43  end
    3544end
    3645
     
    4655  end
    4756  task register.exp.run
     57    active false
     58  end
     59  task register.burntool.load
     60    active false
     61  end
     62  task register.burntool.run
    4863    active false
    4964  end
     
    429444end
    430445
     446
     447# select imfiles that can now be burntooled.
     448task       register.burntool.load
     449  host     local
     450
     451  periods  -poll $LOADPOLL
     452  periods  -exec $LOADEXEC
     453  periods  -timeout 30
     454  npending 1
     455
     456  # silently drop stdout
     457  stdout NULL
     458  stderr $LOGDIR/register.burntool.load.log
     459 
     460  # select entried from the current DB; cycle to the next DB, if it exists
     461  task.exec
     462    $run = regtool -pendingburntoolimfile
     463    if ($DB:n == 0)
     464      option DEFAULT
     465    else
     466      # save the DB name for the exit tasks
     467      option $DB:$regPendingBurntoolImfile_DB
     468      $run = $run -dbname $DB:$regPendingBurntoolImfile_DB
     469      $regPendingBurntoolImfile_DB ++
     470      if ($regPendingBurntoolImfile_DB >= $DB:n) set regPendingBurntoolImfile_DB = 0
     471    end
     472
     473    $today = `date +%Y-%m-%d`
     474    $run = $run -date $today -valid_burntool $valid_burntool_value
     475    add_poll_args run
     476    command $run
     477  end
     478
     479  # success
     480  task.exit $EXIT_SUCCESS
     481    # convert 'stdout' to book format
     482    ipptool2book stdout regPendingBurntoolImfile -key exp_id:class_id -uniq -setword dbname $options:0 -setword pantaskState INIT
     483    book shuffle regPendingBurntoolImfile
     484    if ($VERBOSE > 2)
     485      book listbook regPendingBurntoolImfile
     486    end
     487
     488    # delete existing entries in the appropriate pantasksStates
     489    process_cleanup regPendingBurntoolImfile
     490  end
     491
     492  # locked list
     493  task.exit   default
     494    showcommand failure
     495  end
     496  task.exit   crash
     497    showcommand crash
     498  end
     499  task.exit   timeout
     500    showcommand timeout
     501  end
     502end
     503
     504# run the ipp_apply_burntool_single.pl script on the pending images
     505task          register.burntool.run
     506  periods     -poll $RUNPOLL
     507  periods     -exec $RUNEXEC
     508  periods     -timeout 30
     509
     510  task.exec
     511    if ($NETWORK == 0) break
     512    book npages regPendingBurntoolImfile -var N
     513    if ($N == 0)
     514      periods -exec $RUNEXEC
     515      break
     516    end
     517    periods -exec 0.05
     518
     519    # look for new images to burn in regPendingBurntoolImfile
     520    book getpage regPendingBurntoolImfile 0 -var pageName -key pantaskState INIT
     521    if ("$pageName" == "NULL") break
     522
     523    book setword regPendingBurntoolImfile $pageName pantaskState RUN
     524
     525    book getword regPendingBurntoolImfile $pageName exp_id      -var EXP_ID
     526    book getword regPendingBurntoolImfile $pageName class_id    -var CLASS_ID
     527    book getword regPendingBurntoolImfile $pageName uri         -var THIS_URI
     528    book getword regPendingBurntoolImfile $pageName previous_uri -var PREVIOUS_URI
     529    book getword regPendingBurntoolImfile $pageName camera      -var CAMERA
     530    book getword regPendingBurntoolImfile $pageName dbname      -var DBNAME
     531    set.host.for.camera $CAMERA $CLASS_ID
     532
     533    stdout $LOGDIR/register.burntool.run.log
     534    stderr $LOGDIR/register.burntool.run.log
     535
     536    $run = ipp_apply_burntool_single.pl --exp_id $EXP_ID --class_id $CLASS_ID --this_uri $THIS_URI
     537    if ("$PREVIOUS_URI" != "NULL")
     538      $run = $run --previous_uri $PREVIOUS_URI
     539    end
     540
     541    add_standard_args run
     542
     543    options $pageName
     544
     545    if ($VERBOSE > 1)
     546      echo command $run
     547    end
     548    command $run
     549  end
     550
     551  # default exit status
     552  task.exit default
     553    process_exit regPendingBurntoolImfile $options:0 $JOB_STATUS
     554  end
     555
     556  # locked list
     557  task.exit crash
     558    showcommand crash
     559    echo "hostname: $JOB_HOSTNAME"
     560    book setword regPendingBurntoolImfile $options:0 pantaskState CRASH
     561  end
     562
     563  # operation timed out
     564  task.exit  timeout
     565    showcommand timeout
     566    book setword regPendingBurntoolImfile $options:0 pantaskState TIMEOUT
     567  end
     568end
     569
     570   
     571   
     572 
    431573## XXX add a global path to output files 
Note: See TracChangeset for help on using the changeset viewer.