Best Python code snippet using yandex-tank
instance_plan.py
Source:instance_plan.py
...60 self.wait(step_duration).start(final_instances - self.instances)61 self.wait(step_duration)62 return self63 def add_step(self, step_config):64 def parse_ramp(params):65 template = re.compile(r'(\d+),\s*([0-9.]+[dhms]?)+\)')66 s_res = template.search(params)67 if s_res:68 instances, interval = s_res.groups()69 self.ramp(int(instances), parse_duration(interval))70 else:71 self.log.info(72 "Ramp step format: 'ramp(<instances_to_start>, <step_duration>)'"73 )74 raise StepperConfigurationError(75 "Error in step configuration: 'ramp(%s'" % params)76 def parse_const(params):77 template = re.compile(r'(\d+),\s*([0-9.]+[dhms]?)+\)')78 s_res = template.search(params)...
tss.py
Source:tss.py
...5 ap = argparse.ArgumentParser()6 ap.add_argument("ftp", type=int)7 ap.add_argument("path")8 return ap.parse_args()9def parse_ramp(elem):10 dur = int(elem.attrib["Duration"])11 start = float(elem.attrib["PowerLow"])12 end = float(elem.attrib["PowerHigh"])13 diff = end - start14 return [start + (diff * (d / dur)) for d in range(dur)]15def parse_steadystate(elem):16 return int(elem.attrib["Duration"]) * [float(elem.attrib["Power"])]17def parse_intervals(elem):18 out = []19 for _ in range(int(elem.attrib["Repeat"])):20 out.extend(int(elem.attrib["OnDuration"]) * [float(elem.attrib["OnPower"])])21 out.extend(int(elem.attrib["OffDuration"]) * [float(elem.attrib["OffPower"])])22 return out23TAGS = {...
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!