Best Python code snippet using yandex-tank
plugin.py
Source:plugin.py
...412 config.write(output)413 self.lp_job.send_config_snapshot(output.getvalue())414 with open(os.path.join(self.core.artifacts_dir, 'saved_conf.ini'), 'w') as f:415 config.write(f)416 def parse_lock_targets(self):417 # prepare target lock list418 locks_list_cfg = self.get_option('lock_targets', 'auto').strip()419 def no_target():420 logging.warn("Target lock set to 'auto', but no target info available")421 return ''422 locks_list = (self.target or no_target() if locks_list_cfg.lower() == 'auto' else locks_list_cfg).split('\n')423 targets_to_lock = [host for host in locks_list if host]424 return targets_to_lock425 def lock_targets(self, targets_to_lock, ignore, strict):426 locked_targets = [target for target in targets_to_lock427 if self.lp_job.lock_target(target, self.lock_target_duration, ignore, strict)]428 return locked_targets429 def unlock_targets(self, locked_targets):430 logger.info("Unlocking targets: %s", locked_targets)431 for target in locked_targets:432 logger.info(target)433 self.lp_job.api_client.unlock_target(target)434 def check_and_lock_targets(self, strict, ignore):435 targets_list = self.parse_lock_targets()436 logger.info('Locking targets: %s', targets_list)437 locked_targets = self.lock_targets(targets_list, ignore=ignore, strict=strict)438 logger.info('Locked targets: %s', locked_targets)439 return locked_targets440 def make_symlink(self, name):441 PLUGIN_DIR = os.path.join(self.core.artifacts_base_dir, 'lunapark')442 if not os.path.exists(PLUGIN_DIR):443 os.makedirs(PLUGIN_DIR)444 os.symlink(445 os.path.relpath(446 self.core.artifacts_dir,447 PLUGIN_DIR),448 os.path.join(449 PLUGIN_DIR,...
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!!