IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 32381 for trunk/ippTasks


Ignore:
Timestamp:
Sep 9, 2011, 1:13:09 PM (15 years ago)
Author:
watersc1
Message:

Tasks to manage first copy shuffle.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippTasks/diskbalance.pro

    r32355 r32381  
    1515book init balanceControl
    1616
     17
     18book init targetPending
     19book init targetControl
     20
    1721macro balance.reset
    1822  book init balancePending
     
    4145end
    4246
     47macro target.reset
     48  book init targetPending
     49end
     50
     51macro target.status
     52  book listbook targetPending
     53end
     54
     55macro target.on
     56  task target.load
     57    active true
     58  end
     59  task target.run
     60    active true
     61  end
     62end
     63
     64macro target.off
     65  task target.load
     66    active false
     67  end
     68  task target.run
     69    active false
     70  end
     71end
     72 
    4373macro set.host.for.balance
    4474  if ($0 != 2)
     
    90120 end
    91121 $BALANCE_TARGET = $1
     122end
     123
     124macro show.target.numbers
     125  book listpage targetControl control
     126  echo "target so_ids: $TARGET_SO_ID_START $TARGET_SO_ID_RANGE"
     127end
     128
     129macro show.targetPending
     130  book npages targetPending -var N
     131  echo "$N pages in book"
     132  book listbook targetPending
    92133end
    93134
     
    250291
    251292
    252 
    253    
    254 
     293# This value will need to be incremented periodically.  It looks like we grow by about 5e7 so_ids per month.
     294$TARGET_BIG_SO_ID   = 6e8
     295$TARGET_SO_ID_START = int($TARGET_BIG_SO_ID * rnd(0))
     296$TARGET_SO_ID_RANGE = 500000
     297$TARGET_LIMIT       = 500
     298$TARGET_OFFSET      = 0
     299$TARGET_TARGET      = "SOURCE"
     300# Select Nebulous objects which should be shuffled
     301task           target.load
     302  host         local
     303
     304  periods      -poll 60
     305  periods      -exec 60
     306  periods      -timeout 1500
     307  npending     1
     308
     309  # logs
     310  stdout NULL
     311  stderr $LOGSUBDIR/target.log
     312   
     313  task.exec
     314    book npages targetPending -var N
     315    if ($N > 2000)
     316      process_cleanup targetPending
     317      break
     318    end
     319
     320    command neb-admin --host $NEB_HOST --db $NEB_DB --user $NEB_USER --pass $NEB_PASS --pendingtarget --limit $TARGET_LIMIT --offset $TARGET_OFFSET --so_id_start $TARGET_SO_ID_START --so_id_range $TARGET_SO_ID_RANGE 
     321  end
     322
     323   # success : 0 -- we did not hit the limit, advance so_id counter
     324  task.exit 0
     325    # advance the so_id counter
     326    $TARGET_SO_ID_START = $TARGET_SO_ID_START + $TARGET_SO_ID_RANGE
     327    $TARGET_OFFSET = 0
     328    # convert 'stdout' to book format
     329    ipptool2book stdout targetPending -key key -uniq -setword pantaskState INIT
     330
     331    if ($VERBOSE > 2)
     332      book listbook targetPending
     333    end
     334
     335    # delete existing entries in the appropriate pantaskStates
     336    process_cleanup targetPending
     337  end
     338
     339  # success : 1 -- we DID hit the limit, do NOT advance so_id counter
     340  task.exit 1
     341    # convert 'stdout' to book format
     342    ipptool2book stdout targetPending -key key -uniq -setword pantaskState INIT
     343    $TARGET_OFFSET = $TARGET_OFFSET + $TARGET_LIMIT
     344    if ($VERBOSE > 2)
     345      book listbook targetPending
     346    end
     347
     348    # delete existing entries in the appropriate pantaskStates
     349    process_cleanup targetPending
     350  end
     351
     352  # out of so_id range, reset
     353  task.exit 10
     354    # advance the so_id counter
     355    $TARGET_SO_ID_START = 0
     356  end
     357
     358  # locked list
     359  task.exit    default
     360    showcommand failure
     361  end
     362
     363  task.exit    crash
     364    showcommand crash
     365  end
     366
     367  # operation times out?
     368  task.exit    timeout
     369    showcommand timeout
     370  end
     371end
     372
     373# task to execute shuffles
     374task            target.run
     375  periods       -poll 0.5
     376  periods       -exec 5
     377  periods       -timeout 5
     378  npending      200
     379
     380  task.exec
     381    # if we are unable to run the 'exec', use a long retry time
     382    periods -exec 5
     383
     384    book npages targetPending -var N
     385    if ($NETWORK == 0) break
     386    if ($N == 0) break
     387
     388    # look for new objects in targetPending
     389    book getpage targetPending 0 -var pageName -key pantaskState INIT
     390    if ("$pageName" == "NULL") break
     391
     392    book setword targetPending $pageName pantaskState RUN
     393
     394    book getword targetPending $pageName key              -var KEY
     395    book getword targetPending $pageName source_name      -var SOURCE
     396    book getword targetPending $pageName source_host      -var SOURCE_HOST
     397    book getword targetPending $pageName destination_name -var DESTINATION
     398    book getword targetPending $pageName destination_host -var DEST_HOST
     399    book getword targetPending $pageName destination_uri  -var DEST_URI
     400    book getword targetPending $pageName ins_id           -var INS_ID
     401
     402    # Fix this with multihost restriction when possible.
     403    if ("$TARGET_TARGET" == "DESTINATION")
     404       set.host.for.target $DEST_HOST
     405    else
     406       set.host.for.target $SOURCE_HOST
     407    end
     408   
     409
     410    stdout NULL
     411    stderr $LOGSUBDIR/target.log
     412
     413    $run = neb-insedit --key $KEY --ins_id $INS_ID --uri $DEST_URI --volume $DESTINATION
     414    $run = $run --db $NEB_DB --host $NEB_HOST --user $NEB_USER --pass $NEB_PASS
     415    $run = $run --neb_host http://ippc04/nebulous
     416   
     417    # save the pageName for future reference below
     418    options $pageName
     419
     420    # create the command line
     421    if ($VERBOSE > 1)
     422        echo command $run
     423    end
     424    periods -exec 0.05
     425    command $run
     426  end
     427
     428  # default exit status
     429  task.exit     default
     430    process_exit targetPending $options:0 $JOB_STATUS
     431  end
     432
     433  task.exit    crash
     434    showcommand crash
     435    book setword targetPending $options:0 pantaskState CRASH
     436  end
     437
     438  # operation timed out?
     439  task.exit    timeout
     440    showcommand timeout
     441    book setword targetPending $options:0 pantaskState TIMEOUT
     442  end
     443end
     444
     445
     446
     447   
     448
Note: See TracChangeset for help on using the changeset viewer.