Best Python code snippet using yandex-tank
plugin.py
Source:plugin.py
...720 self.api_client.lock_target(lock_target, lock_target_duration, trace=self.log_other_requests,721 maintenance_timeouts=maintenance_timeouts,722 maintenance_msg="Target is locked.\nManual unlock link: %s%s" % (723 self.api_client.base_url,724 self.api_client.get_manual_unlock_link(lock_target)725 ))726 return True727 except (APIClient.NotAvailable, APIClient.StoppedFromOnline) as e:728 logger.info('Target is not locked due to %s', e.message)729 if ignore:730 logger.info('ignore_target_locks = 1')731 return False732 elif strict:733 raise e734 else:735 logger.info('strict_lock = 0')736 return False737 except APIClient.UnderMaintenance:738 logger.info('Target is locked')739 if ignore:740 logger.info('ignore_target_locks = 1')741 return False742 logger.info("Manual unlock link: %s%s", self.api_client.base_url,743 self.api_client.get_manual_unlock_link(lock_target))744 continue745 def set_imbalance_and_dsc(self, rps, comment):746 return self.api_client.set_imbalance_and_dsc(self.number, rps, comment)747 def is_target_locked(self, host, strict):748 while True:749 try:750 return self.api_client.is_target_locked(751 host, trace=self.log_other_requests)752 except APIClient.UnderMaintenance:753 logger.info('Target is locked, retrying...')754 continue755 except (APIClient.StoppedFromOnline, APIClient.NotAvailable, APIClient.NetworkError):756 logger.warn('Can\'t check whether target is locked\n')757 if strict:...
client.py
Source:client.py
...507 (target, int(duration))508 res = self.__get(addr, trace=trace, maintenance_timeouts=maintenance_timeouts, maintenance_msg=maintenance_msg)509 return res[0]510 def unlock_target(self, target):511 addr = self.get_manual_unlock_link(target)512 res = self.__get(addr)513 return res[0]514 def get_virtual_host_info(self, hostname):515 addr = "api/server/virtual_host.json?hostname=%s" % hostname516 res = self.__get(addr)517 try:518 return res[0]519 except KeyError:520 raise Exception(res['error'])521 @staticmethod522 def get_manual_unlock_link(target):523 return "api/server/lock.json?action=unlock&address=%s" % target524 def send_config_snapshot(self, jobno, config, trace=False):525 logger.debug("Sending config snapshot")526 addr = "api/job/%s/configinfo.txt" % jobno527 self.__post_raw(addr, {"configinfo": config}, trace=trace)528class OverloadClient(APIClient):529 def send_status(self, jobno, upload_token, status, trace=False):530 return531 def lock_target(self, target, duration, trace=False, **kwargs):532 return533 def unlock_target(self, *args, **kwargs):...
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!!