Skip to content

Commit

Permalink
Merge "Changes Timestamp to hold float instead of datetime"
Browse files Browse the repository at this point in the history
  • Loading branch information
Jenkins authored and openstack-gerrit committed Jan 15, 2015
2 parents 6643102 + ccb5c79 commit 0e8bb4b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 10 deletions.
5 changes: 2 additions & 3 deletions rally/benchmark/runners/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def _run_scenario_once(args):
"status": status})

return {"duration": timer.duration() - scenario.idle_duration(),
"timestamp": str(timer.timestamp()),
"timestamp": timer.timestamp(),
"idle_duration": scenario.idle_duration(),
"error": error,
"scenario_output": scenario_output,
Expand All @@ -104,8 +104,7 @@ class ScenarioRunnerResult(dict):
"type": "number"
},
"timestamp": {
"type": "string",
"format": "date-time"
"type": "number"
},
"idle_duration": {
"type": "number"
Expand Down
3 changes: 1 addition & 2 deletions rally/common/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# License for the specific language governing permissions and limitations
# under the License.

import datetime
import functools
import imp
import inspect
Expand Down Expand Up @@ -87,7 +86,7 @@ def __enter__(self):
return self

def timestamp(self):
return datetime.datetime.fromtimestamp(self.start)
return self.start

def __exit__(self, type, value, tb):
self.finish = time.time()
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/benchmark/runners/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def test_run_scenario_once_without_scenario_output(self, mock_clients,

expected_result = {
"duration": fakes.FakeTimer().duration(),
"timestamp": str(fakes.FakeTimer().timestamp()),
"timestamp": fakes.FakeTimer().timestamp(),
"idle_duration": 0,
"error": [],
"scenario_output": {"errors": "", "data": {}},
Expand All @@ -122,7 +122,7 @@ def test_run_scenario_once_with_scenario_output(self, mock_clients,

expected_result = {
"duration": fakes.FakeTimer().duration(),
"timestamp": str(fakes.FakeTimer().timestamp()),
"timestamp": fakes.FakeTimer().timestamp(),
"idle_duration": 0,
"error": [],
"scenario_output": fakes.FakeScenario().with_output(),
Expand All @@ -140,7 +140,7 @@ def test_run_scenario_once_exception(self, mock_clients, mock_rtimer):
expected_error = result.pop("error")
expected_result = {
"duration": fakes.FakeTimer().duration(),
"timestamp": str(fakes.FakeTimer().timestamp()),
"timestamp": fakes.FakeTimer().timestamp(),
"idle_duration": 0,
"scenario_output": {"errors": "", "data": {}},
"atomic_actions": {}
Expand Down
3 changes: 1 addition & 2 deletions tests/unit/fakes.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# License for the specific language governing permissions and limitations
# under the License.

import datetime
import multiprocessing
import random
import re
Expand Down Expand Up @@ -1318,7 +1317,7 @@ def duration(self):
return 10

def timestamp(self):
return datetime.datetime(2015, 1, 1)
return 0


@base_ctx.context("fake", order=1)
Expand Down

0 comments on commit 0e8bb4b

Please sign in to comment.