IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 25, 2021, 4:33:46 PM (5 years ago)
Author:
eugene
Message:

updates to rebalance code

Location:
trunk/tools/eam/rebalance
Files:
1 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/tools/eam/rebalance/rebalance.mana

    r41407 r41508  
    261261
    262262    echo "rsyncing $srcdir/ to $tgtdir/ : $movelog"
     263    break -auto off
    263264    exec rsync -auv --files-from=$movelist $srcdir/ $tgtdir/ >& $movelog
     265    break -auto on
    264266  end
    265267end
     
    388390  end
    389391
    390   local srchost tgthost srcvol tgtvol
     392  local srchost tgthost srcvol tgtvol isFound myfile
    391393
    392394  $srchost = $1
     
    415417    for j 0 $files:n
    416418      # move the file to the trash directory
    417       echo mv $srcdir/$files:$j $trashdir
    418       exec mv $srcdir/$files:$j $trashdir
     419     
     420      $myfile = $srcdir/$files:$j
     421      file $myfile isFound
     422      if (not($isFound))
     423        echo "$myfile not found, skipping"
     424        continue
     425      end
     426      echo mv $myfile $trashdir
     427      exec mv $myfile $trashdir
    419428    end
    420429  end
     
    463472  else
    464473    echo "SUCCESS: no check errors detected"
     474  end
     475end
     476
     477# names are defined for a single src & tgt pair
     478macro run.location.check
     479  if ($0 != 6)
     480    echo "USAGE: run.location.check (srchost) (srcvol) (tgthost) (tgtvol) (VERSION)"
     481    echo "srchost, tgthost : e.g., ipp070"
     482    echo "srcvol, tgtvol   : e.g., 0 (for /data/ipp070.0/nebulous)"
     483    break
     484  end
     485
     486  local srchost tgthost srcvol tgtvol
     487
     488  $srchost = $1
     489  $srcvol = $2
     490
     491  $source = /data/$srchost.$srcvol/nebulous
     492
     493  $tgthost = $3
     494  $tgtvol = $4
     495  $VERSION = $5
     496 
     497  $myhost = `hostname`
     498  if ("$myhost" != "$tgthost")
     499    echo "please run on $tgthost"
     500    break
     501  end
     502
     503  # I have a list of files in 'movelist' for which I want to check copy locations
     504  # if the neb-entries have number of user copies != 2, the file is OK
     505  # if the neb-entries is >= 2, one should be on a backup node
     506
     507  for i 0 $NSUBDIR
     508    sprintf srcdir "%s/%02x" $source $i
     509    sprintf subdir "%02x" $i
     510
     511    # generate initial file list (all big files)
     512    sprintf movelist %s/rebalance/movefiles.%s.txt $srcdir $VERSION
     513    sprintf checklog %s/rebalance/movefiles.%s.loc $srcdir $VERSION
     514
     515     echo ./neb_check_location.pl --tgthost $tgthost --tgtvol $tgtvol --subdir $subdir --list $movelist > $checklog
     516    $EXEC ./neb_check_location.pl --tgthost $tgthost --tgtvol $tgtvol --subdir $subdir --list $movelist > $checklog
     517  end
     518end
     519
     520# names are defined for a single src & tgt pair
     521macro run.location.fix
     522  if ($0 != 6)
     523    echo "USAGE: run.location.fix (srchost) (srcvol) (tgthost) (tgtvol) (VERSION)"
     524    echo "srchost, tgthost : e.g., ipp070"
     525    echo "srcvol, tgtvol   : e.g., 0 (for /data/ipp070.0/nebulous)"
     526    break
     527  end
     528
     529  local srchost tgthost srcvol tgtvol
     530
     531  $srchost = $1
     532  $srcvol = $2
     533
     534  $source = /data/$srchost.$srcvol/nebulous
     535
     536  $tgthost = $3
     537  $tgtvol = $4
     538  $VERSION = $5
     539 
     540  $myhost = `hostname`
     541  if ("$myhost" != "$tgthost")
     542    echo "please run on $tgthost"
     543    break
     544  end
     545
     546  # I have a list of files in 'movelist' for which I want to check copy locations
     547  # if the neb-entries have number of user copies != 2, the file is OK
     548  # if the neb-entries is >= 2, one should be on a backup node
     549
     550  for i 0 $NSUBDIR
     551    sprintf srcdir "%s/%02x" $source $i
     552    sprintf subdir "%02x" $i
     553
     554    # generate initial file list (all big files)
     555    sprintf movelist %s/rebalance/movefiles.%s.txt $srcdir $VERSION
     556    sprintf checklog %s/rebalance/movefiles.%s.loc $srcdir $VERSION
     557
     558     echo ./neb_check_location.pl --tgthost $tgthost --tgtvol $tgtvol --subdir $subdir --list $movelist > $checklog
    465559  end
    466560end
     
    513607    echo "USAGE: rebalance.mana (MODE) (srchost) (srcvol) (tgthost) (tgtvol) (VERSION) [options]"
    514608    echo ""
    515     echo "MODE: find.test, find, rsync, rsync.check, insert, insert.check, trash, trash.check, empty.trash"
     609    echo "MODE: find.test, find, rsync, rsync.check, insert, insert.check, location.check, trash, trash.check, empty.trash"
    516610    echo ""
    517611    echo "srchost, tgthost : e.g., ipp070"
     
    604698  end
    605699
     700  #### location.check ####
     701  if ("$argv:0" == "location.check")
     702    if ($argv:n != 6)
     703      echo "USAGE: rebalance.mana (location.check) (srchost) (srcvol) (tgthost) (tgtvol) (VERSION)"
     704      break
     705    end
     706    run.location.check $argv:1 $argv:2 $argv:3 $argv:4 $argv:5
     707    exit 0
     708  end
     709
     710  #### location.fix ####
     711  if ("$argv:0" == "location.fix")
     712    if ($argv:n != 6)
     713      echo "USAGE: rebalance.mana (location.fix) (srchost) (srcvol) (tgthost) (tgtvol) (VERSION)"
     714      break
     715    end
     716    run.location.fix $argv:1 $argv:2 $argv:3 $argv:4 $argv:5
     717    exit 0
     718  end
     719
    606720  #### empty.trash ####
    607721  if ("$argv:0" == "empty.trash")
Note: See TracChangeset for help on using the changeset viewer.