mirror of
https://github.com/valitydev/yandex-tank.git
synced 2024-11-07 10:49:00 +00:00
pylint warnings
This commit is contained in:
parent
dcb2ad84d0
commit
69deb89b7b
@ -356,7 +356,7 @@ class QuantileCriteria(AbstractCriteria):
|
|||||||
|
|
||||||
def notify(self, aggregate_second):
|
def notify(self, aggregate_second):
|
||||||
if not (self.quantile in aggregate_second.overall.quantiles.keys()):
|
if not (self.quantile in aggregate_second.overall.quantiles.keys()):
|
||||||
self.log.warning("No qunatile %s in %s", self.timing, aggregate_second.overall.quantiles)
|
self.log.warning("No quantile %s in %s", self.quantile, aggregate_second.overall.quantiles)
|
||||||
if self.quantile in aggregate_second.overall.quantiles.keys() \
|
if self.quantile in aggregate_second.overall.quantiles.keys() \
|
||||||
and aggregate_second.overall.quantiles[self.quantile] > self.rt_limit:
|
and aggregate_second.overall.quantiles[self.quantile] > self.rt_limit:
|
||||||
if not self.seconds_count:
|
if not self.seconds_count:
|
||||||
|
@ -28,7 +28,7 @@ class JMeterPlugin(AbstractPlugin):
|
|||||||
self.user_args = None
|
self.user_args = None
|
||||||
self.jmeter_path = None
|
self.jmeter_path = None
|
||||||
self.jmeter_log = None
|
self.jmeter_log = None
|
||||||
self.start_time=time.time()
|
self.start_time = time.time()
|
||||||
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@ -77,8 +77,8 @@ class JMeterPlugin(AbstractPlugin):
|
|||||||
|
|
||||||
def start_test(self):
|
def start_test(self):
|
||||||
self.log.info("Starting %s with arguments: %s", self.jmeter_path, self.args)
|
self.log.info("Starting %s with arguments: %s", self.jmeter_path, self.args)
|
||||||
self.jmeter_process = subprocess.Popen(self.args, executable=self.jmeter_path, preexec_fn=os.setsid, close_fds=True) # stderr=subprocess.PIPE, stdout=subprocess.PIPE,
|
self.jmeter_process = subprocess.Popen(self.args, executable=self.jmeter_path, preexec_fn=os.setsid, close_fds=True) # stderr=subprocess.PIPE, stdout=subprocess.PIPE,
|
||||||
self.start_time=time.time()
|
self.start_time = time.time()
|
||||||
|
|
||||||
|
|
||||||
def is_test_finished(self):
|
def is_test_finished(self):
|
||||||
@ -97,7 +97,7 @@ class JMeterPlugin(AbstractPlugin):
|
|||||||
os.killpg(self.jmeter_process.pid, signal.SIGTERM)
|
os.killpg(self.jmeter_process.pid, signal.SIGTERM)
|
||||||
except OSError, exc:
|
except OSError, exc:
|
||||||
self.log.debug("Seems JMeter exited itself: %s", exc)
|
self.log.debug("Seems JMeter exited itself: %s", exc)
|
||||||
#Utils.log_stdout_stderr(self.log, self.jmeter_process.stdout, self.jmeter_process.stderr, "jmeter")
|
# Utils.log_stdout_stderr(self.log, self.jmeter_process.stdout, self.jmeter_process.stderr, "jmeter")
|
||||||
|
|
||||||
self.core.add_artifact_file(self.jmeter_log)
|
self.core.add_artifact_file(self.jmeter_log)
|
||||||
return retcode
|
return retcode
|
||||||
@ -106,7 +106,7 @@ class JMeterPlugin(AbstractPlugin):
|
|||||||
def __add_writing_section(self, jmx, jtl):
|
def __add_writing_section(self, jmx, jtl):
|
||||||
''' Genius idea by Alexey Lavrenyuk '''
|
''' Genius idea by Alexey Lavrenyuk '''
|
||||||
self.log.debug("Original JMX: %s", os.path.realpath(jmx))
|
self.log.debug("Original JMX: %s", os.path.realpath(jmx))
|
||||||
src_jmx=open(jmx, 'r')
|
src_jmx = open(jmx, 'r')
|
||||||
source_lines = src_jmx.readlines()
|
source_lines = src_jmx.readlines()
|
||||||
src_jmx.close()
|
src_jmx.close()
|
||||||
try:
|
try:
|
||||||
@ -117,7 +117,7 @@ class JMeterPlugin(AbstractPlugin):
|
|||||||
except Exception, exc:
|
except Exception, exc:
|
||||||
raise RuntimeError("Failed to find the end of JMX XML: %s" % exc)
|
raise RuntimeError("Failed to find the end of JMX XML: %s" % exc)
|
||||||
|
|
||||||
tpl_file=open(os.path.dirname(__file__) + '/jmeter_writer.xml', 'r')
|
tpl_file = open(os.path.dirname(__file__) + '/jmeter_writer.xml', 'r')
|
||||||
tpl = tpl_file.read()
|
tpl = tpl_file.read()
|
||||||
tpl_file.close()
|
tpl_file.close()
|
||||||
|
|
||||||
@ -172,7 +172,7 @@ class JMeterReader(AbstractReader):
|
|||||||
line = line.strip()
|
line = line.strip()
|
||||||
if not line:
|
if not line:
|
||||||
return None
|
return None
|
||||||
#timeStamp,elapsed,label,responseCode,success,bytes,grpThreads,allThreads,Latency
|
# timeStamp,elapsed,label,responseCode,success,bytes,grpThreads,allThreads,Latency
|
||||||
data = line.split("\t")
|
data = line.split("\t")
|
||||||
if len(data) != 9:
|
if len(data) != 9:
|
||||||
self.log.warning("Wrong jtl line, skipped: %s", line)
|
self.log.warning("Wrong jtl line, skipped: %s", line)
|
||||||
@ -234,7 +234,7 @@ class JMeterInfoWidget(AbstractInfoWidget, AggregateResultListener):
|
|||||||
''' Right panel widget with JMeter test info '''
|
''' Right panel widget with JMeter test info '''
|
||||||
def __init__(self, jmeter):
|
def __init__(self, jmeter):
|
||||||
AbstractInfoWidget.__init__(self)
|
AbstractInfoWidget.__init__(self)
|
||||||
self.krutilka=ConsoleScreen.krutilka()
|
self.krutilka = ConsoleScreen.krutilka()
|
||||||
self.jmeter = jmeter
|
self.jmeter = jmeter
|
||||||
self.active_threads = 0
|
self.active_threads = 0
|
||||||
self.rps = 0
|
self.rps = 0
|
||||||
@ -253,7 +253,7 @@ class JMeterInfoWidget(AbstractInfoWidget, AggregateResultListener):
|
|||||||
right_spaces = space / 2
|
right_spaces = space / 2
|
||||||
|
|
||||||
dur_seconds = int(time.time()) - int(self.jmeter.start_time)
|
dur_seconds = int(time.time()) - int(self.jmeter.start_time)
|
||||||
duration=str(datetime.timedelta(seconds=dur_seconds))
|
duration = str(datetime.timedelta(seconds=dur_seconds))
|
||||||
|
|
||||||
template = screen.markup.BG_MAGENTA + '~' * left_spaces + jmeter + ' ' + '~' * right_spaces + screen.markup.RESET + "\n"
|
template = screen.markup.BG_MAGENTA + '~' * left_spaces + jmeter + ' ' + '~' * right_spaces + screen.markup.RESET + "\n"
|
||||||
template += " Test Plan: %s\n"
|
template += " Test Plan: %s\n"
|
||||||
|
@ -413,9 +413,7 @@ class PhantomReader(AbstractReader):
|
|||||||
self.log.debug("Instances info buffer size: %s", len(self.stat_data))
|
self.log.debug("Instances info buffer size: %s", len(self.stat_data))
|
||||||
|
|
||||||
def __read_phout_data(self, force):
|
def __read_phout_data(self, force):
|
||||||
'''
|
''' Read phantom results '''
|
||||||
Read phantom results
|
|
||||||
'''
|
|
||||||
if self.phout and len(self.data_queue) < self.buffered_seconds * 2:
|
if self.phout and len(self.data_queue) < self.buffered_seconds * 2:
|
||||||
self.log.debug("Reading phout, up to 10MB...")
|
self.log.debug("Reading phout, up to 10MB...")
|
||||||
phout = self.phout.readlines(10 * 1024 * 1024)
|
phout = self.phout.readlines(10 * 1024 * 1024)
|
||||||
@ -445,7 +443,7 @@ class PhantomReader(AbstractReader):
|
|||||||
tstmp = float(data[0])
|
tstmp = float(data[0])
|
||||||
cur_time = int(tstmp + float(rt_real) / 1000000)
|
cur_time = int(tstmp + float(rt_real) / 1000000)
|
||||||
|
|
||||||
if cur_time in self.stat_data.keys(): # FIXME: optimize
|
if cur_time in self.stat_data.keys():
|
||||||
active = self.stat_data[cur_time]
|
active = self.stat_data[cur_time]
|
||||||
else:
|
else:
|
||||||
active = 0
|
active = 0
|
||||||
@ -491,6 +489,7 @@ class PhantomReader(AbstractReader):
|
|||||||
|
|
||||||
|
|
||||||
def __aggregate_next_second(self):
|
def __aggregate_next_second(self):
|
||||||
|
''' calls aggregator if there is data '''
|
||||||
parsed_sec = AbstractReader.pop_second(self)
|
parsed_sec = AbstractReader.pop_second(self)
|
||||||
if parsed_sec:
|
if parsed_sec:
|
||||||
self.pending_second_data_queue.append(parsed_sec)
|
self.pending_second_data_queue.append(parsed_sec)
|
||||||
@ -502,6 +501,7 @@ class PhantomReader(AbstractReader):
|
|||||||
|
|
||||||
|
|
||||||
def __process_pending_second(self):
|
def __process_pending_second(self):
|
||||||
|
''' process data in queue '''
|
||||||
next_time = int(time.mktime(self.pending_second_data_queue[0].time.timetuple()))
|
next_time = int(time.mktime(self.pending_second_data_queue[0].time.timetuple()))
|
||||||
if self.last_sample_time and (next_time - self.last_sample_time) > 1:
|
if self.last_sample_time and (next_time - self.last_sample_time) > 1:
|
||||||
self.last_sample_time += 1
|
self.last_sample_time += 1
|
||||||
|
@ -496,6 +496,7 @@ class QuantileOfSaturationCriteria(AbstractCriteria):
|
|||||||
|
|
||||||
|
|
||||||
def __get_timing_quantile(self, aggr_data):
|
def __get_timing_quantile(self, aggr_data):
|
||||||
|
''' get quantile level for criteria timing '''
|
||||||
quan = 0.0
|
quan = 0.0
|
||||||
for timing in sorted(aggr_data.cumulative.times_dist.keys()):
|
for timing in sorted(aggr_data.cumulative.times_dist.keys()):
|
||||||
timing_item = aggr_data.cumulative.times_dist[timing]
|
timing_item = aggr_data.cumulative.times_dist[timing]
|
||||||
|
Loading…
Reference in New Issue
Block a user