예제 #1
0
def showStats(data, stats: Stats):
    width, height = get_terminal_size()
    console.clearScreen()
    separator = '_' * width
    lines = []
    lines.append(Fore.YELLOW + 'ZEUS LISTENER SERVICE STATS')
    lines.append(Fore.WHITE + 'Browser: ' + Fore.GREEN + data['browser'])
    lines.append(Fore.WHITE + 'Driver : ' + Fore.GREEN + data['driver'])
    lines.append('')
    lines += stats.getConsoleLines(width)
    lines.append(Fore.CYAN + 'Queue: %s:' % data['queueUrl'])
    lines.append(Fore.BLUE + separator)
    lines.append(Fore.WHITE + 'Elapsed time     : %s' %
                 (Fore.GREEN + data['elapsedTime']))
    lines.append(Fore.WHITE +
                 'Total process    : %6d' % int(data['totalProcess']))
    lines.append(Fore.WHITE + 'Message in queue : %6d/%6d' % (
        int(data['queueAttributes']['ApproximateNumberOfMessages']),
        int(data['queueAttributes']['ApproximateNumberOfMessagesNotVisible'])))
    lines.append(Fore.BLUE + separator)
    index = 1
    for line in lines:
        console.printAt(1, index, line)
        index += 1

    stdout.write('\n')
    stdout.flush()
예제 #2
0
def showStats(data, queueUrl, stats: Stats):
    totalThreads = 0
    totalMessages = 0
    for count in data['threadsCount']:
        totalThreads += count

    for count in data['messagesCount']:
        totalMessages += count

    width, height = get_terminal_size()
    console.clearScreen()
    separator = '_' * width
    lines = []
    lines.append(Fore.YELLOW + 'ZEUS LISTENER SERVICE STATS')
    lines.append(Fore.WHITE + 'Browser: ' + Fore.GREEN + data['browser'])
    lines.append(Fore.WHITE + 'Driver : ' + Fore.GREEN + data['driver'])
    lines.append('')
    lines += stats.getConsoleLines(width)
    lines.append(Fore.CYAN + 'Queue: %s:' % queueUrl)
    lines.append(Fore.BLUE + separator)
    lines.append(Fore.WHITE + 'Elapsed time  : %s' %
                 (Fore.GREEN + data['elapsedTime']))
    lines.append(Fore.WHITE + 'Total process : %7d, threads: %7d' %
                 (int(data['totalProcess']), totalThreads))
    lines.append(Fore.WHITE + 'Message read  : %7d' % totalMessages)
    lines.append(Fore.BLUE + separator)

    index = 1
    for line in lines:
        console.printAt(1, index, line)
        index += 1

    with lockThreadsCount:
        totalCounts = len(threadsCount)
        nbrlines = round(totalCounts / 4)
        if nbrlines == 0:
            nbrlines = 1
        step = round(width / 4)
        tc = 0
        for l in range(nbrlines):
            for c in range(4):
                if tc < totalCounts:
                    console.printAt(
                        c * step, l + index, '#%d T:%d M:%d' %
                        (tc, threadsCount[tc], messagesCount[tc]))
                tc += 1

    stdout.write('\n')
    stdout.flush()
예제 #3
0
def showStats(totalProcess, systemStats: Stats, listenerStats: Array):

    width, height = get_terminal_size()
    elapsedTime = str(timedelta(seconds=round(time() - startTime)))
    console.clearScreen()
    separator = '_' * width
    lines = []
    lines.append(Fore.YELLOW + 'ZEUS LISTENER SERVICE STATS')
    #lines.append(Fore.WHITE + 'Browser: ' + Fore.GREEN + data['browser'])
    #lines.append(Fore.WHITE + 'Driver : ' + Fore.GREEN + data['driver'])
    #lines.append('')
    lines += systemStats.getConsoleLines(width)
    #lines.append(Fore.CYAN + 'Queue: %s:' % queueUrl)
    lines.append(Fore.BLUE + separator)
    lines.append(Fore.WHITE + 'Elapsed time  : %s' %
                 (Fore.GREEN + elapsedTime))
    lines.append(Fore.WHITE + 'Total process : %7d' % totalProcess)
    lines.append(
        Fore.WHITE +
        'Logged in: %7d   Played: %7d   Error: %7d   Driver None: %7d' %
        (listenerStats[STAT_LOGGED_IN], listenerStats[STAT_PLAYED],
         listenerStats[STAT_ERROR], listenerStats[STAT_DRIVER_NONE]))
    lines.append(Fore.BLUE + separator)
    index = 1
    for line in lines:
        console.printAt(1, index, line)
        index += 1
    ''' index = 1
    for line in lines:
        console.printAt(1, index, line)
        index += 1

    with lockThreadsCount:
        totalCounts = len(threadsCount)
        nbrlines = round(totalCounts / 4)
        if nbrlines == 0:
            nbrlines = 1
        step = round(width / 4)
        tc = 0
        for l in range(nbrlines):
            for c in range(4):
                if tc < totalCounts:
                    console.printAt(c*step, l+index, '#%d T:%d M:%d' % (tc, threadsCount[tc], messagesCount[tc]))
                tc+=1
 '''
    stdout.write('\n')
    stdout.flush()
예제 #4
0
파일: sp-stats.py 프로젝트: adelamarre/zeus
def showStats(data, queueUrl, stats: Stats):
    width, height = get_terminal_size()

    separator = '_' * width
    lines = []
    lines.append(Fore.YELLOW + 'AMAZON SQS SERVICE STATS')
    lines.append('\n')
    lines = lines + stats.getConsoleLines(width)
    lines.append(Fore.CYAN + 'Queue: %s:' % queueUrl)
    lines.append(Fore.BLUE + separator)
    lines.append(Fore.WHITE + 'Available messages: %6d' %
                 int(data['ApproximateNumberOfMessages']))
    lines.append(Fore.WHITE + 'Message in use    : %6d' %
                 int(data['ApproximateNumberOfMessagesNotVisible']))
    lines.append(Fore.BLUE + separator)
    console.clearScreen()
    index = 1
    for line in lines:
        console.printAt(1, index, line)
        index += 1

    stdout.flush()
예제 #5
0
                  "%m-%d-%Y-%H-%M-%S") + '/'
    logfile = logDir + 'all.log'
    os.makedirs(logDir, exist_ok=True)
    screenshotDir = logDir + 'screenshot/'
    os.makedirs(screenshotDir, exist_ok=True)

    #Util
    shutdownEvent = Event()
    config = Config()
    console = Console(ouput=not noOutput, logfile=logfile)
    proxyRegisterManager = ProxyManager(proxyFile=PROXY_FILE_REGISTER)
    proxyListenerManager = ProxyManager(proxyFile=PROXY_FILE_LISTENER)
    userManager = UserManager(console)
    userAgentManager = UserAgentManager()
    client = boto3.client('sqs')
    systemStats = Stats()
    processes = []
    users = []

    maxProcess = config.REGISTER_MAX_PROCESS
    if maxProcess < 0:
        maxProcess = psutil.cpu_count(logical=True)

    #Process communication
    runnerStats = Array('i', 4)
    processStates = Array('i', maxProcess)
    runnerStats[STAT_ACCOUNT_CREATED] = 0
    runnerStats[STAT_ERROR] = 0
    runnerStats[STAT_DRIVER_NONE] = 0

    try:
예제 #6
0
        if arg == '--headless':
            headless = True
        if arg == '--vnc':
            vnc = True

    shutdownEvent = Event()
    config = Config()
    processes = []
    console = Console(ouput=not noOutput)
    driverManager = DriverManager(console, shutdownEvent)
    driverVersion = driverManager.getDriverVersion('chrome')
    browserVersion = driverManager.getBrowserVersion('chrome')
    client = boto3.client('sqs')

    totalMessageReceived = 0
    stats = Stats()
    messages = []
    lastProcessStart = 0
    lockThreadsCount = Lock()

    def _showStats():
        showStats(
            {
                'totalProcess': len(processes),
                'totalMessageReceived': totalMessageReceived,
                'elapsedTime': str(
                    timedelta(seconds=round(time() - startTime))),
                'browser': browserVersion,
                'driver': driverVersion,
                'threadsCount': threadsCount,
                'messagesCount': messagesCount,