- Timestamp:
- Mar 5, 2012, 5:19:48 PM (14 years ago)
- Location:
- branches/meh_branches/ppstack_test
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
ippTasks/diskbalance.pro (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/meh_branches/ppstack_test
- Property svn:mergeinfo changed
-
branches/meh_branches/ppstack_test/ippTasks/diskbalance.pro
r31882 r33415 15 15 book init balanceControl 16 16 17 18 book init targetPending 19 book init targetControl 20 17 21 macro balance.reset 18 22 book init balancePending … … 41 45 end 42 46 47 macro target.reset 48 book init targetPending 49 end 50 51 macro target.status 52 book listbook targetPending 53 end 54 55 macro target.on 56 task target.load 57 active true 58 end 59 task target.run 60 active true 61 end 62 end 63 64 macro target.off 65 task target.load 66 active false 67 end 68 task target.run 69 active false 70 end 71 end 72 43 73 macro set.host.for.balance 44 74 if ($0 != 2) … … 71 101 book setword balanceControl control mDestinations $2 72 102 end 103 104 macro 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 112 end 113 73 114 74 115 macro show.balance.numbers … … 92 133 end 93 134 135 macro 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 143 end 144 145 146 macro show.target.numbers 147 echo "target so_ids: $TARGET_SO_ID_START $TARGET_SO_ID_RANGE" 148 end 149 150 macro show.targetPending 151 book npages targetPending -var N 152 echo "$N pages in book" 153 book listbook targetPending 154 end 155 94 156 # the balance process interacts with only the single Nebulous server 95 157 … … 104 166 $BALANCE_LIMIT = 500 105 167 $BALANCE_OFFSET = 0 106 $BALANCE_TARGET = "SOURCE"168 $BALANCE_TARGET = SOURCE 107 169 # Select Nebulous objects which should be shuffled 108 170 task balance.load … … 250 312 251 313 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 322 task 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 392 end 393 394 # task to execute shuffles 395 task 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.balance $DEST_HOST 426 else 427 set.host.for.balance $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 464 end 465 466
Note:
See TracChangeset
for help on using the changeset viewer.
