Speed up swift-get-nodes by 2x.
It was loading the ring off disk once to print the primary nodes, and then loading the whole thing off disk again to print the handoff nodes. Changed it to only load the ring off disk once. Change-Id: I6f4cd0af9762e1e69660c3eb20586590b5339e5f
This commit is contained in:
1 changed files with 10 additions and 7 deletions
@@ -42,27 +42,30 @@ obj = None
if len(sys.argv) > 4:
# Acount, Container and Object
ring, account, container, obj = sys.argv[1:5]
ring_file, account, container, obj = sys.argv[1:5]
ring = Ring(ring_file)
hash_str = hash_path(account, container, obj)
part, nodes = Ring(ring).get_nodes(account, container, obj)
part, nodes = ring.get_nodes(account, container, obj)
target = "%s/%s/%s" % (account, container, obj)
loc = 'objects'
elif len(sys.argv) > 3:
# Account, Container
ring, account, container = sys.argv[1:4]
ring_file, account, container = sys.argv[1:4]
ring = Ring(ring_file)
hash_str = hash_path(account, container)
part, nodes = Ring(ring).get_nodes(account, container)
part, nodes = ring.get_nodes(account, container)
target = "%s/%s" % (account, container)
loc = 'containers'
elif len(sys.argv) > 2:
# Account
ring, account = sys.argv[1:3]
ring_file, account = sys.argv[1:3]
ring = Ring(ring_file)
hash_str = hash_path(account)
part, nodes = Ring(ring).get_nodes(account)
part, nodes = ring.get_nodes(account)
target = "%s" % (account)
loc = 'accounts'
more_nodes = list(Ring(ring).get_more_nodes(part))
more_nodes = list(ring.get_more_nodes(part))
print '\nAccount \t%s' % account
print 'Container\t%s' % container
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.