IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 8, 2011, 2:44:12 PM (15 years ago)
Author:
eugene
Message:

merge changes from trunk

Location:
branches/eam_branches/ipp-20110906
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20110906

  • branches/eam_branches/ipp-20110906/ippTasks/diskbalance.pro

    r32355 r32630  
    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)
     
    71101  book setword balanceControl control mDestinations $2
    72102end
     103
     104macro set.balance.range
     105  if ($0 != 3)
     106    echo "USAGE: set.balance.range (SO_ID_START) (SO_ID_RANGE)"
     107    break
     108  end
     109
     110  $BALANCE_SO_ID_START = $1
     111  $BALANCE_SO_ID_RANGE = $2
     112end
     113
    73114
    74115macro show.balance.numbers
     
    90131 end
    91132 $BALANCE_TARGET = $1
     133end
     134
     135macro set.target.range
     136  if ($0 != 3)
     137    echo "USAGE: set.target.range (SO_ID_START) (SO_ID_RANGE)"
     138    break
     139  end
     140
     141  $TARGET_SO_ID_START = $1
     142  $TARGET_SO_ID_RANGE = $2
     143end
     144
     145
     146macro show.target.numbers
     147  echo "target so_ids: $TARGET_SO_ID_START $TARGET_SO_ID_RANGE"
     148end
     149
     150macro show.targetPending
     151  book npages targetPending -var N
     152  echo "$N pages in book"
     153  book listbook targetPending
    92154end
    93155
     
    250312
    251313
    252 
    253    
    254 
     314# This value will need to be incremented periodically.  It looks like we grow by about 5e7 so_ids per month.
     315$TARGET_BIG_SO_ID   = 6e8
     316$TARGET_SO_ID_START = int($TARGET_BIG_SO_ID * rnd(0))
     317$TARGET_SO_ID_RANGE = 500000
     318$TARGET_LIMIT       = 500
     319$TARGET_OFFSET      = 0
     320$TARGET_TARGET      = "SOURCE"
     321# Select Nebulous objects which should be shuffled
     322task           target.load
     323  host         local
     324
     325  periods      -poll 60
     326  periods      -exec 60
     327  periods      -timeout 1500
     328  npending     1
     329
     330  # logs
     331  stdout NULL
     332  stderr $LOGSUBDIR/target.log
     333   
     334  task.exec
     335    book npages targetPending -var N
     336    if ($N > 2000)
     337      process_cleanup targetPending
     338      break
     339    end
     340
     341    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 
     342  end
     343
     344   # success : 0 -- we did not hit the limit, advance so_id counter
     345  task.exit 0
     346    # advance the so_id counter
     347    $TARGET_SO_ID_START = $TARGET_SO_ID_START + $TARGET_SO_ID_RANGE
     348    $TARGET_OFFSET = 0
     349    # convert 'stdout' to book format
     350    ipptool2book stdout targetPending -key key -uniq -setword pantaskState INIT
     351
     352    if ($VERBOSE > 2)
     353      book listbook targetPending
     354    end
     355
     356    # delete existing entries in the appropriate pantaskStates
     357    process_cleanup targetPending
     358  end
     359
     360  # success : 1 -- we DID hit the limit, do NOT advance so_id counter
     361  task.exit 1
     362    # convert 'stdout' to book format
     363    ipptool2book stdout targetPending -key key -uniq -setword pantaskState INIT
     364    $TARGET_OFFSET = $TARGET_OFFSET + $TARGET_LIMIT
     365    if ($VERBOSE > 2)
     366      book listbook targetPending
     367    end
     368
     369    # delete existing entries in the appropriate pantaskStates
     370    process_cleanup targetPending
     371  end
     372
     373  # out of so_id range, reset
     374  task.exit 10
     375    # advance the so_id counter
     376    $TARGET_SO_ID_START = 0
     377  end
     378
     379  # locked list
     380  task.exit    default
     381    showcommand failure
     382  end
     383
     384  task.exit    crash
     385    showcommand crash
     386  end
     387
     388  # operation times out?
     389  task.exit    timeout
     390    showcommand timeout
     391  end
     392end
     393
     394# task to execute shuffles
     395task            target.run
     396  periods       -poll 0.5
     397  periods       -exec 5
     398  periods       -timeout 5
     399  npending      200
     400
     401  task.exec
     402    # if we are unable to run the 'exec', use a long retry time
     403    periods -exec 5
     404
     405    book npages targetPending -var N
     406    if ($NETWORK == 0) break
     407    if ($N == 0) break
     408
     409    # look for new objects in targetPending
     410    book getpage targetPending 0 -var pageName -key pantaskState INIT
     411    if ("$pageName" == "NULL") break
     412
     413    book setword targetPending $pageName pantaskState RUN
     414
     415    book getword targetPending $pageName key              -var KEY
     416    book getword targetPending $pageName source_name      -var SOURCE
     417    book getword targetPending $pageName source_host      -var SOURCE_HOST
     418    book getword targetPending $pageName destination_name -var DESTINATION
     419    book getword targetPending $pageName destination_host -var DEST_HOST
     420    book getword targetPending $pageName destination_uri  -var DEST_URI
     421    book getword targetPending $pageName ins_id           -var INS_ID
     422
     423    # Fix this with multihost restriction when possible.
     424    if ("$TARGET_TARGET" == "DESTINATION")
     425       set.host.for.target $DEST_HOST
     426    else
     427       set.host.for.target $SOURCE_HOST
     428    end
     429   
     430
     431    stdout NULL
     432    stderr $LOGSUBDIR/target.log
     433
     434    $run = neb-insedit --key $KEY --ins_id $INS_ID --uri $DEST_URI --volume $DESTINATION
     435    $run = $run --db $NEB_DB --host $NEB_HOST --user $NEB_USER --pass $NEB_PASS
     436    $run = $run --neb_host http://ippc04/nebulous
     437   
     438    # save the pageName for future reference below
     439    options $pageName
     440
     441    # create the command line
     442    if ($VERBOSE > 1)
     443        echo command $run
     444    end
     445    periods -exec 0.05
     446    command $run
     447  end
     448
     449  # default exit status
     450  task.exit     default
     451    process_exit targetPending $options:0 $JOB_STATUS
     452  end
     453
     454  task.exit    crash
     455    showcommand crash
     456    book setword targetPending $options:0 pantaskState CRASH
     457  end
     458
     459  # operation timed out?
     460  task.exit    timeout
     461    showcommand timeout
     462    book setword targetPending $options:0 pantaskState TIMEOUT
     463  end
     464end
     465
     466
Note: See TracChangeset for help on using the changeset viewer.