def __init__(self, folder, timeout, max_fails): ''' initialize class :param string folder: absolute path of the log file directory :param int timeout: maximum time in seconds that one robot is allowed to do nothing before it is assumed that it failed :param int max_fails: maximum number of allowed consecutive failures ''' # absolute path of the log file directory self.folder = folder # maximum time in seconds that one robot is allowed to do nothing before it is assumed that it failed self.timeout = timeout # maximum number of allowed consecutive failures self.max_fails = max_fails # mavros log files self.mavros_logs = dict([(f.split('_')[1].split('-')[0], log.Log(folder, f)) for f in os.listdir(folder) if f.find("-mavros-") > 0]) # coverage log files self.coverage_logs = dict([(f.split('_')[1].split('-')[0], log.Log(folder, f)) for f in os.listdir(folder) if f.find("uav_coverage") > 0])
def __init__(self, ip, port, username, passwd, hostname, user): self.tran = paramiko.Transport(( ip, port, )) self.tran.start_client() self.tran.auth_password(username, passwd) self.chan = self.tran.open_session() self.chan.get_pty() self.chan.invoke_shell() self.oldtty = termios.tcgetattr(sys.stdin) self.log = log.Log() self.log.logger.error('user:%s login host:%s' % (user, hostname))
import modules.log as g_log MAX_FILE_SIZE_MB = 5 ALLOWED_EXTENSIONS = set(['.png', '.jpg', '.jpeg']) ACCESS_TOKEN_EXPIRES = 60 * 60 # 1 hr log = g_log.Log() logger = log; config = {} config_vals = { 'secrets':{ 'section': 'general', 'default': None, 'type': 'string', }, 'processes':{ 'section': 'general', 'default': '1', 'type': 'int', }, 'images_path':{ 'section': 'general', 'default': './images', 'type': 'string', }, 'db_path':{ 'section': 'general', 'default': './db',