def update_loaded_clients(module_object,class_name): global import_manifest, loaded_clients, init_logger try: class_object = getattr(module_object,class_name) aliases = import_manifest[class_name+"_alias"] updates = dict( [(alias,class_object) for alias in aliases] ) loaded_clients.update(updates) except: init_logger.warning("Unable to load client %s." % class_name) init_logger.info(str(exc))
err1 = "An attempt to load client %s failed. " % class_name err2 = "A dependency of this client may not be installed." err3 = "REASON: %s" % str(exc) #spaces are for output formating. init_logger.warning(err1) init_logger.warning(err2) init_logger.warning(err3) return None,None except Exception,exc: #let users keep working even if some clients can't be loaded. #Assumption is the user is requesting a working client and #shouldn't be prevented from running load tests because there #is a busted client. If this proves to be trouble in practice #simply remove this exception handler and the locust binary #will error out early. init_logger.warning("Unable to load client %s." % class_name) init_logger.info(str(exc)) return None,None def update_loaded_clients(module_object,class_name): global import_manifest, loaded_clients, init_logger try: class_object = getattr(module_object,class_name) aliases = import_manifest[class_name+"_alias"] updates = dict( [(alias,class_object) for alias in aliases] ) loaded_clients.update(updates) except: init_logger.warning("Unable to load client %s." % class_name) init_logger.info(str(exc)) def load_all_clients():