Merge pull request #49 from morucci/issue-39-41

Issue 39 41
This commit is contained in:
Chmouel Boudjnah
2013-04-10 08:07:01 -07:00
4 changed files with 24 additions and 13 deletions

View File

@@ -72,9 +72,12 @@ def main():
parser.print_help()
sys.exit(1)
concurrency = int(utils.get_config('filler', 'concurrency'))
pile = eventlet.GreenPile(concurrency)
pool = eventlet.GreenPool(concurrency)
sw_c_concu = int(utils.get_config('filler',
'swift_client_concurrency'))
ks_c_concu = int(utils.get_config('filler',
'keystone_client_concurrency'))
pile = eventlet.GreenPile(sw_c_concu)
pool = eventlet.GreenPool(ks_c_concu)
_config = utils.get_config('auth',
'keystone_origin_admin_credentials').split(':')

View File

@@ -8,14 +8,18 @@ keystone_origin_demo_credentials = demo:demo:ADMIN
keystone_dest_credentials = demo:demo:ADMIN
[sync]
# This is usually bound to the max open files.
max_gthreads = 10
[filler]
swift_operator_role = Member
concurrency = 1
default_user_password = password
default_user_email = johndoe@domain.com
index_path = /tmp/swift_filler_index.pkl
index_containers_path = /tmp/swift_filler_containers_index.pkl
[concurrency]
keystone_client_concurrency = 5
swift_client_concurrency = 10
# This is usually bound to the max open files.
sync_swift_client_concurrency = 10

View File

@@ -26,8 +26,9 @@ import swsync.utils
class Containers(object):
"""Containers sync."""
def __init__(self):
self.max_gthreads = int(swsync.utils.get_config("sync",
"max_gthreads"))
self.concurrency = int(swsync.utils.get_config(
"concurrency",
"sync_swift_client_concurrency"))
self.sync_object = swsync.objects.sync_object
self.delete_object = swsync.objects.delete_object
@@ -38,7 +39,7 @@ class Containers(object):
set2 = set((x['name']) for x in dest_containers)
delete_diff = set2 - set1
pool = eventlet.GreenPool(size=self.max_gthreads)
pool = eventlet.GreenPool(size=self.concurrency)
pile = eventlet.GreenPile(pool)
for container in delete_diff:
try:
@@ -115,7 +116,7 @@ class Containers(object):
if not diff and not delete_diff:
return
pool = eventlet.GreenPool(size=self.max_gthreads)
pool = eventlet.GreenPool(size=self.concurrency)
pile = eventlet.GreenPile(pool)
for obj in diff:

View File

@@ -138,7 +138,8 @@ class TestFiller(base.TestCase):
self.stubs.Set(filler, 'create_objects', create_objects)
self.stubs.Set(filler, 'create_containers', create_containers)
concurrency = int(utils.get_config('filler', 'concurrency'))
concurrency = int(utils.get_config('concurrency',
'swift_client_concurrency'))
pool = eventlet.GreenPool(concurrency)
created = {('account1', 'account1_id'): ['test', 'test_id', 'role_id'],
@@ -202,7 +203,8 @@ class TestFiller(base.TestCase):
self.stubs.Set(filler, 'create_swift_user', create_swift_user)
concurrency = int(utils.get_config('filler', 'concurrency'))
concurrency = int(utils.get_config('concurrency',
'keystone_client_concurrency'))
pile = eventlet.GreenPile(concurrency)
client = FakeKSClient()
filler.create_swift_account(client, pile, 1, 1, self.ret_index)
@@ -230,7 +232,8 @@ class TestFiller(base.TestCase):
self.stubs.Set(client.tenants, 'create', create_tenant)
self.stubs.Set(filler, 'create_swift_user', create_swift_user)
concurrency = int(utils.get_config('filler', 'concurrency'))
concurrency = int(utils.get_config('concurrency',
'keystone_client_concurrency'))
pile = eventlet.GreenPile(concurrency)
filler.create_swift_account(client, pile, 3, 1, self.ret_index)