14 Commits

Author SHA1 Message Date
Mikhail Dubov
3d6b7adc3c Improve rally.utils.log_task_wrapper()
1) Make the docstring pep8-compatible (add single-line description & :param:)
2) Make the log messages more readable for the user

Change-Id: I567ac32fadf9adf45c754fd9856160bc5244eae2
2013-10-20 23:17:19 +04:00
Boris Pavlovic
9ede402f1b Add utils.log_task_wrapper() method
This wrapper add before and after method excecution logs messages:

params = {'task': self.task['uuid'], 'msg': msg % kw}

Log _("Task %(task)s start: %(msg)s") % params
Exectue your method
Log _("Task %(task)s finish: %(msg)s) % params

bp logging

Change-Id: Ib07fe5cfd00637c14010cfe5f49cae9fe55f5eaf
2013-10-20 15:53:11 +04:00
Boris Pavlovic
b0336c99ce Remove vim header
Do not use vim header

Change-Id: Idc06835b0a86c1e4a79b596318e8f73e861247bd
2013-10-13 16:49:37 +04:00
Mikhail Dubov
51ae9447c9 Improve utils.wait_for()
1) Rename the 'sleep' parameter to 'check_interval' for more clarity;
2) Add another test for the case when update_resource=None (better coverage);
3) Reduce the running time of the method call in the tests.

Change-Id: If2c6770fb18714fc8fbee0ac0493fb02bbdfea08
2013-10-12 19:11:03 +04:00
Mikhail Dubov
b15a5a311f Rewrite rally.utils.sync_execute() to wait_for()
The patch simplifies the logic of rally.utils.sync_execute(), removing
the function call from this method. It is assumed that the function call
to create the desired resource will be performed by the developers before
calling wait_for(), which would result in a bit of code duplicate but would
significantly improve the overall code readability.

Blueprint benchmark-scenarios

Change-Id: Ieeb365d394b6dad6016047c3b4e6eb0e2543a613
2013-10-10 18:13:29 +04:00
Mikhail Dubov
37be71cb98 Reducing the running time for test_sync_execute()
This patch reduces the time it takes for the test method
tests.test_utils.SyncExecuteTestCase.test_sync_execute to
complete its work. The runnig time gets reduced from ~5.0 sec
to ~0.3 sec.

Change-Id: I83bbdea4d12aa1ad5aeeccd1a15c4838ef9c419b
Closes-Bug: #1235791
2013-10-06 16:25:15 +04:00
Boris Pavlovic
d3473afc19 Add Timer to rally.utils
This is small and pretty class for with statement that measure time.

Example of usage:

with Timer() as timer:
	#do some dirty stuff
time_in_seconds = timer.duration()

It will be used at least by our Test engine.

Change-Id: I3bf0075df807c2118d5872dd425aae0061232133
2013-10-04 00:56:34 +04:00
Mikhail Dubov
04f42b867a Slight improvement for utils.sync_execute
This patch slightly improves the utils.sync_execute method, adding the 'args'
parameter to it.

Change-Id: Ibf3c3cdce16ff94f52214a0a2fce1e89f41003cc
2013-10-03 16:23:31 +04:00
Mikhail Dubov
351ca7bc83 Function synchronization utility
The patch introduces a wrapper for an asynchronous function call that turns
this call into a synchronous one. The wrapper assumes that the called function
immediately returns an object for which it takes some time to get to the
'ready for use' state.

Change-Id: I5a9182e2218112b65b58f478d1d5b51f58b05e16
2013-10-01 17:57:06 +04:00
Boris Pavlovic
a32b67e00e Move and refactor ImmutableMixin & EnumMixin to rally.utils
First of all these two mixins will be used not only for rally.consts
So move it to rally.utils

Improve ImmutableMixin, to be able to set parameters in __init__() method

Relax EnumMixin consts type, were supported only string values

Add tests for ImnutableMixin and EnumMixin

Change-Id: I52a0d3810c62855024bc3da34db1134e8ebde149
2013-09-29 03:17:41 +04:00
Alexei Kornienko
4898aea328 Fixed import utils code
Added exception paththrough in case module cannot be loaded.

Change-Id: Ia429c25d550e11f95a6b7f62636e239eeb4022b8
2013-09-26 15:55:44 +03:00
Sergey Vilgelm
f736996a22 Import modules from package
Add function import_modules_from_package into rally.utils
Use import_modules_from_package in deplog and vmprovide for load engines and providers

Change-Id: I42400db8cc8f1d8ba2a14f3195df71dc60cae036
2013-09-08 12:21:31 +04:00
Boris Pavlovic
0c0c85d971 Add itersubclasses() method that allows to iter through all subclass
Add to rally.utils one new method.
This method is required at least to build deploy EngineFactory.
2013-09-01 02:12:12 +04:00
ekonstantinov
1888c3d2cf Init benchmark framework
We add rally.benchmark module that contains Tester.
This is base of our benchmark framework. It allows us to easy write
test scenarios that could call any test N times simuntaneously and collect results

Add rally.utils stdout captures that allows us to caputre stdout and stderr in easy
way using "with" expression.

Add test for our benchmark base and rally.utils
2013-09-01 01:28:51 +04:00