yandex / yandex-tank

Load and performance benchmark tool
Other
2.46k stars 278 forks source link

Agregator bug/lucid #10

Closed doctornkz closed 12 years ago

doctornkz commented 12 years ago

doctor@lucid64:~$ dpkg -l | grep tank ii yandex-load-tank-base 1.0.11 Yandex.Tank (Load Testing Tool)

$ cat load.conf [phantom] rps_schedule=const (10,60)

[monitoring] config = none

01:55:57 INFO: Exception: Traceback (most recent call last): File "/usr/lib/yandex-tank/Tank/ConsoleWorker.py", line 290, in perform_test retcode = self.core.wait_for_finish() File "/usr/lib/yandex-tank/Tank/Core.py", line 129, in wait_for_finish retcode = plugin.is_test_finished() File "/usr/lib/yandex-tank/Tank/Plugins/Aggregator.py", line 70, in is_test_finished self.read_samples(5) File "/usr/lib/yandex-tank/Tank/Plugins/Aggregator.py", line 65, in __read_samples self.notify_listeners(data) File "/usr/lib/yandex-tank/Tank/Plugins/Aggregator.py", line 83, in __notify_listeners listener.aggregate_second(data) File "/usr/lib/yandex-tank/Tank/Plugins/Phantom.py", line 528, in aggregate_second self.time_lag = int((datetime.datetime.now() - second_aggregate_data.time).total_seconds()) AttributeError: 'datetime.timedelta' object has no attribute 'total_seconds'

01:55:57 ERROR: 'datetime.timedelta' object has no attribute 'total_seconds' 01:55:57 INFO: Trying to shutdown gracefully... 01:55:57 INFO: Finishing test... 01:55:57 ERROR: Failed finishing plugin <Aggregator.AggregatorPlugin instance at 0x1f06b48>: 'datetime.timedelta' object has no attribute 'total_seconds' 01:55:57 WARNING: Terminating phantom process with PID 18603 01:55:57 INFO: Finishing monitoring 01:55:57 INFO: Post-processing test... 01:55:57 INFO: Artifacts dir: ./2012-09-29_01-55-57.YKRlTH 01:55:57 INFO: Done graceful shutdown. 01:55:57 INFO: Done performing test with code 1

epikhinm commented 12 years ago

Lucid have Python 2.6 default. But, for this function timedelta.total_seconds( http://docs.python.org/library/datetime.html#datetime.timedelta.total_seconds ) you need Python 2.7. Upgrade your ubuntu to precise, or python to version 2.7.

doctornkz commented 12 years ago

Yandex-tank MUST work propertly on Lucid without any hacks/upgrades default enviroment. Please, dont close issues before undera's respond.

doctornkz commented 12 years ago
diff --git a/Tank/Plugins/Phantom.py b/Tank/Plugins/Phantom.py
index fb95df2..7a8422c 100644
--- a/Tank/Plugins/Phantom.py
+++ b/Tank/Plugins/Phantom.py
@@ -525,8 +525,12 @@ class PhantomInfoWidget(AbstractInfoWidget, AggregateResultListener):
         self.RPS = second_aggregate_data.overall.RPS
         self.selfload = second_aggregate_data.overall.selfload
         self.log.debug("%s %s", second_aggregate_data.time.timetuple(), self.owner.phantom_start_time)
-        self.time_lag = int((datetime.datetime.now() - second_aggregate_data.time).total_seconds())
-    
+        self.time_lag = int(total_seconds((datetime.datetime.now() - second_aggregate_data.time)))
+
+
+def total_seconds(td):
+    return (td.microseconds + (td.seconds + td.days * 24 * 3600) * 10**6) / 10**6
+

class PhantomReader(AbstractReader):
     '''