diff --git a/zaqar/bench/conductor.py b/zaqar/bench/conductor.py index bfba5bec6..274c6b10c 100644 --- a/zaqar/bench/conductor.py +++ b/zaqar/bench/conductor.py @@ -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 diff --git a/zaqar/bench/consumer.py b/zaqar/bench/consumer.py index 6e0162af3..bd2bb18a0 100644 --- a/zaqar/bench/consumer.py +++ b/zaqar/bench/consumer.py @@ -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)] diff --git a/zaqar/bench/helpers.py b/zaqar/bench/helpers.py new file mode 100644 index 000000000..a31499c23 --- /dev/null +++ b/zaqar/bench/helpers.py @@ -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) diff --git a/zaqar/bench/observer.py b/zaqar/bench/observer.py index 44f595517..9a2e5f4e4 100644 --- a/zaqar/bench/observer.py +++ b/zaqar/bench/observer.py @@ -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)] diff --git a/zaqar/bench/producer.py b/zaqar/bench/producer.py index 9c12e9bd3..8bcb94224 100644 --- a/zaqar/bench/producer.py +++ b/zaqar/bench/producer.py @@ -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)]