Merge "Fix zaqar-bench not working"
This commit is contained in:
commit
0f0087940b
@ -17,10 +17,9 @@ from __future__ import print_function
|
||||
import json
|
||||
import multiprocessing as mp
|
||||
|
||||
from zaqarclient.queues import client
|
||||
|
||||
from zaqar.bench import config
|
||||
from zaqar.bench import consumer
|
||||
from zaqar.bench import helpers
|
||||
from zaqar.bench import observer
|
||||
from zaqar.bench import producer
|
||||
|
||||
@ -39,7 +38,7 @@ def _print_verbose_stats(name, stats):
|
||||
|
||||
|
||||
def _reset_queues():
|
||||
cli = client.Client(CONF.server_url, 1.1)
|
||||
cli = helpers.get_new_client()
|
||||
|
||||
for i in range(CONF.num_queues):
|
||||
# TODO(kgriffs): DRY up name generation so it is done
|
||||
|
@ -24,10 +24,10 @@ from gevent import monkey as curious_george
|
||||
curious_george.patch_all(thread=False, select=False)
|
||||
import gevent
|
||||
import marktime
|
||||
from zaqarclient.queues import client
|
||||
from zaqarclient.transport import errors
|
||||
|
||||
from zaqar.bench import config
|
||||
from zaqar.bench import helpers
|
||||
|
||||
CONF = config.conf
|
||||
|
||||
@ -95,7 +95,7 @@ def claim_delete(queues, stats, test_duration, ttl, grace, limit):
|
||||
def load_generator(stats, num_workers, num_queues,
|
||||
test_duration, url, ttl, grace, limit):
|
||||
|
||||
cli = client.Client(CONF.server_url)
|
||||
cli = helpers.get_new_client()
|
||||
queues = [cli.queue(CONF.queue_prefix + '-' + str(i))
|
||||
for i in range(num_queues)]
|
||||
|
||||
|
31
zaqar/bench/helpers.py
Normal file
31
zaqar/bench/helpers.py
Normal file
@ -0,0 +1,31 @@
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from zaqarclient.queues import client
|
||||
|
||||
from zaqar.bench import config
|
||||
|
||||
CONF = config.conf
|
||||
|
||||
client_conf = {
|
||||
'auth_opts': {
|
||||
'backend': 'noauth',
|
||||
'options': {
|
||||
'os_project_id': 'my-lovely-benchmark',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
def get_new_client():
|
||||
return client.Client(CONF.server_url, 1.1, conf=client_conf)
|
@ -25,10 +25,10 @@ curious_george.patch_all(thread=False, select=False)
|
||||
import gevent
|
||||
import marktime
|
||||
from six.moves import urllib
|
||||
from zaqarclient.queues import client
|
||||
from zaqarclient.transport import errors
|
||||
|
||||
from zaqar.bench import config
|
||||
from zaqar.bench import helpers
|
||||
|
||||
CONF = config.conf
|
||||
|
||||
@ -99,7 +99,7 @@ def observer(queues, stats, test_duration, limit):
|
||||
def load_generator(stats, num_workers, num_queues,
|
||||
test_duration, limit):
|
||||
|
||||
cli = client.Client(CONF.server_url)
|
||||
cli = helpers.get_new_client()
|
||||
queues = [cli.queue(CONF.queue_prefix + '-' + str(i))
|
||||
for i in range(num_queues)]
|
||||
|
||||
|
@ -25,10 +25,10 @@ from gevent import monkey as curious_george
|
||||
curious_george.patch_all(thread=False, select=False)
|
||||
import gevent
|
||||
import marktime
|
||||
from zaqarclient.queues import client
|
||||
from zaqarclient.transport import errors
|
||||
|
||||
from zaqar.bench import config
|
||||
from zaqar.bench import helpers
|
||||
|
||||
CONF = config.conf
|
||||
|
||||
@ -104,7 +104,7 @@ def producer(queues, message_pool, stats, test_duration):
|
||||
# weight them, so can have some busy queues, some not.)
|
||||
def load_generator(stats, num_workers, num_queues, test_duration):
|
||||
|
||||
cli = client.Client(CONF.server_url)
|
||||
cli = helpers.get_new_client()
|
||||
queues = [cli.queue(CONF.queue_prefix + '-' + str(i))
|
||||
for i in range(num_queues)]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user