How to use update_af_progress method in yandex-tank

Best Python code snippet using yandex-tank

info.py

Source:info.py Github

copy

Full Screen

...41 return self._af_position42 @af_position.setter43 def af_position(self, value):44 self._af_position = value45 self.update_af_progress()46 @property47 def ammo_count(self):48 return self._ammo_count49 @ammo_count.setter50 def ammo_count(self, value):51 self._ammo_count = value52 self.update_lp_progress()53 if self.ammo_limit and value > self.ammo_limit:54 print55 log.info("Ammo limit reached: %s", self.ammo_limit)56 raise StopIteration57 def inc_ammo_count(self):58 self.ammo_count += 159 @property60 def loop_count(self):61 return self._loop_count62 @loop_count.setter63 def loop_count(self, value):64 self._loop_count = value65 if self.loop_limit and value >= self.loop_limit:66 print # do not overwrite status (go to new line)67 log.info("Loop limit reached: %s", self.loop_limit)68 raise StopIteration69 def inc_loop_count(self):70 self.loop_count += 171 def get_info(self):72 self.info['ammo_count'] = self._ammo_count73 self.info['loop_count'] = self._loop_count74 for key in self.info:75 if self.info[key] is None:76 raise RuntimeError(77 "Information for %s is not published yet." % key)78 return StepperInfo(**self.info)79 def update_view(self):80 ammo_generated = self._ammo_count - self._old_ammo_count81 self._old_ammo_count = self._ammo_count82 cur_time = time.time()83 time_delta = cur_time - self._timer84 self._timer = cur_time85 if time_delta > 0:86 stdout.write(87 "AF: %3s%%, LP: %3s%%, loops: %10s, speed: %5s Krps\r" % (88 self.af_progress, self.lp_progress, self.loop_count,89 int(ammo_generated / time_delta / 1000.0)))90 stdout.flush()91 if self.core:92 self.core.publish("stepper", "progress", self.lp_progress)93 self.core.publish("stepper", "loop_count", self.loop_count)94 self.core.publish(95 "stepper", "speed",96 "%s Krps" % int(ammo_generated / time_delta / 1000.0))97 def update_af_progress(self):98 if self.af_size and self.loop_limit and self.af_position is not None:99 bytes_read = self.af_size * self.loop_count + self.af_position100 total_bytes = self.af_size * self.loop_limit101 progress = int(float(bytes_read) / float(total_bytes) * 100.0)102 else:103 progress = 100104 if self.af_progress != progress:105 self.af_progress = progress106 self.update_view()107 def update_lp_progress(self):108 if self.ammo_limit or self.lp_len:109 if self.ammo_limit:110 if self.lp_len:111 max_ammo = min(self.ammo_limit, self.lp_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