How to use recalc_active method in yandex-tank

Best Python code snippet using yandex-tank

screen.py

Source:screen.py Github

copy

Full Screen

...184 self.data = {}185 self.window = window186 self.active_seconds = []187 self.ticks = '_▁▂▃▄▅▆▇'188 def recalc_active(self, ts):189 if not self.active_seconds:190 self.active_seconds.append(ts)191 self.data[ts] = {}192 if ts not in self.active_seconds:193 if ts > max(self.active_seconds):194 for i in range(max(self.active_seconds) + 1, ts + 1):195 self.active_seconds.append(i)196 self.active_seconds.sort()197 self.data[i] = {}198 while len(self.active_seconds) > self.window:199 self.active_seconds.pop(0)200 for sec in tuple(self.data.keys()):201 if sec not in self.active_seconds:202 self.data.pop(sec)203 def get_key_data(self, key):204 result = []205 if not self.active_seconds:206 return None207 for sec in self.active_seconds:208 if key in self.data[sec]:209 result.append(self.data[sec][key])210 else:211 result.append(('', 0))212 return result213 def add(self, ts, key, value, color=''):214 if ts not in self.data:215 self.recalc_active(ts)216 if ts < min(self.active_seconds):217 self.log.warning('Sparkline got outdated second %s, oldest in list %s', ts, min(self.active_seconds))218 return219 value = max(value, 0)220 self.data[ts][key] = (color, value)221 def get_sparkline(self, key, baseline='zero', spark_len='auto', align='right'):222 if spark_len == 'auto':223 spark_len = self.window224 elif spark_len <= 0:225 return ''226 key_data = self.get_key_data(key)227 if not key_data:228 return ''229 active_data = key_data[-spark_len:]...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run yandex-tank automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful