benchmark: allow to wait for all measures to be processed
Change-Id: I2b1ee876a39ccbf2ead15cf93bad9999844ffbbc
This commit is contained in:
parent
8d0657306a
commit
5bb14201f9
|
@ -245,6 +245,10 @@ class CliBenchmarkMeasuresAdd(CliBenchmarkBase,
|
|||
default=timeutils.utcnow(True),
|
||||
type=timeutils.parse_isotime,
|
||||
help="Last timestamp to use")
|
||||
parser.add_argument("--wait",
|
||||
default=False,
|
||||
action='store_true',
|
||||
help="Wait for all measures to be processed")
|
||||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
|
@ -292,6 +296,22 @@ class CliBenchmarkMeasuresAdd(CliBenchmarkBase,
|
|||
)
|
||||
)
|
||||
|
||||
if parsed_args.wait:
|
||||
with timeutils.StopWatch() as sw:
|
||||
while True:
|
||||
status = self.app.client.status.get()
|
||||
remaining = int(status['storage']['summary']['measures'])
|
||||
if remaining == 0:
|
||||
stats['extra wait to process measures'] = (
|
||||
"%s seconds" % sw.elapsed()
|
||||
)
|
||||
break
|
||||
else:
|
||||
LOG.info(
|
||||
"Remaining measures to be processed: %d"
|
||||
% remaining)
|
||||
time.sleep(1)
|
||||
|
||||
return self.dict2columns(stats)
|
||||
|
||||
|
||||
|
|
|
@ -82,6 +82,15 @@ class BenchmarkMetricTest(base.ClientTestBase):
|
|||
self.assertEqual(2, int(result['push executed']))
|
||||
self.assertLessEqual(int(result['push failures']), 2)
|
||||
|
||||
result = self.gnocchi(
|
||||
u'benchmark',
|
||||
params=u"measures add --wait -s 2010-01-01 -n 10 -b 4 %s"
|
||||
% metric['id'])
|
||||
result = self.details_multiple(result)[0]
|
||||
self.assertEqual(2, int(result['push executed']))
|
||||
self.assertLessEqual(int(result['push failures']), 2)
|
||||
self.assertIn("extra wait to process measures", result)
|
||||
|
||||
def test_benchmark_measures_show(self):
|
||||
apname = str(uuid.uuid4())
|
||||
# PREPARE AN ARCHIVE POLICY
|
||||
|
|
Loading…
Reference in New Issue