????

Your IP : 3.149.237.146


Current Path : /lib/python3.6/site-packages/glances/__pycache__/
Upload File :
Current File : //lib/python3.6/site-packages/glances/__pycache__/standalone.cpython-36.pyc

3

9��c��@s�dZddlZddlZddlmZddlmZddlmZddl	m
Z
ddlmZddl
mZdd	lmZddlmZdd
lmZddlmZddlmZdd
lmZddlmZGdd�de�ZdS)z&Manage the Glances standalone session.�N)�WINDOWS)�logger)�GlancesStdoutJson)�glances_processes)�GlancesStats)�GlancesCursesStandalone)�
GlancesStdout)�GlancesStdoutCsv)�GlancesStdoutIssue)�GlancesStdoutApiDoc)�Outdated)�Counterc@sXeZdZdZddd�Zedd��Zdd�Zd	d
�Zdd�Z	d
d�Z
ddd�Zdd�ZdS)�GlancesStandalonez>This class creates and manages the Glances standalone session.NcCs�||_||_|j|_|j|_t�}|j�t||d�|_	t
jdj|j
���|jrd|j�tjd�|js~t
jd�tj�nt
jd�tj�|jdk	r�|jt_tr�|jr�tj�|j�|j	j�t
jdj|j
���|jr�t
jd�dt_n�|j�rt
jd�t||d�|_n�|j �r8t
jd	�t!||d�|_n�|j"�rbt
jd
j|j"��t#||d�|_nh|j$�r�t
jdj|j$��t%||d�|_n>|j&�r�t
jdj|j&��t'||d�|_nd
t_t(||d�|_dS)N)�config�argsz+Plugins initialisation duration: {} secondsrz+Extended stats for top process are disabledz*Extended stats for top process are enabledz'First stats update duration: {} secondsz+Quiet mode is ON, nothing will be displayedzIssue mode is ONzFields descriptions mode is ONz8Stdout mode is ON, following stats will be displayed: {}z=Stdout JSON mode is ON, following stats will be displayed: {}z<Stdout CSV mode is ON, following stats will be displayed: {}�2))rr�quiet�_quiet�time�refresh_timer
�resetr�statsr�debug�format�getZmodules_list�display_modules_list�sys�exitZenable_process_extendedrZdisable_extendedZenable_extendedZprocess_filterrZno_kernel_threadsZdisable_kernel_threads�update�infoZ
max_processesZstdout_issuer
�screenZ
stdout_apidocr�stdoutrZstdout_jsonrZ
stdout_csvr	r)�selfrrZstart_duration�r#� /usr/lib/python3.6/standalone.py�__init__"sV








zGlancesStandalone.__init__cCs|jS)N)r)r"r#r#r$rjszGlancesStandalone.quietcCsHtdjdjt|jjdd�����tdjdjt|jjdd�����dS)zDisplay modules listzPlugins list: {}z, F)�enablezExporters list: {}N)�printr�join�sortedrZgetPluginsListZgetExportsList)r"r#r#r$rns"z&GlancesStandalone.display_modules_listcCs|jj|j�}|j�|S)zbSpecial mode for the --issue option

        Update is done in the screen.update function
        )r rr�end)r"�retr#r#r$�serve_issuesszGlancesStandalone.serve_issuecCs�t�}|jj�tjdj|j���t�}|jj|j�tjdj|j���|j|j�}|dkrf|nd}|j	s�|j
j|j|d�}ntj|�d}|S)zkMain loop for the CLI.

        :return: True if we should continue (no exit key has been pressed)
        z"Stats updated duration: {} secondsz#Stats exported duration: {} secondsr)ZdurationT)
r
rrrrrrZexportrrr rZsleep)r"ZcounterZcounter_exportZadapted_refreshr+r#r#r$Z__serve_once|s

zGlancesStandalone.__serve_oncecCs<|jjr*x.t|jj�D]}|j�sPqWnx|j�r6q,WdS)z&Wrapper to the serve_forever function.N)rZ
stop_after�range�_GlancesStandalone__serve_once)r"�_r#r#r$�
serve_forever�s
zGlancesStandalone.serve_forever�cCs xt|�D]}|j�s
Pq
WdS)z
Serve n time.N)r-r.)r"�nr/r#r#r$�serve_n�szGlancesStandalone.serve_ncCs|js|jj�|jj�dS)zEnd of the standalone CLI.N)rr r*r)r"r#r#r$r*�s
zGlancesStandalone.end)NN)r1)
�__name__�
__module__�__qualname__�__doc__r%�propertyrrr,r.r0r3r*r#r#r#r$rs
H	#
r)r7rrZglances.globalsrZglances.loggerrZ#glances.outputs.glances_stdout_jsonrZglances.processesrZ
glances.statsrZglances.outputs.glances_cursesrZglances.outputs.glances_stdoutrZ"glances.outputs.glances_stdout_csvr	Z$glances.outputs.glances_stdout_issuer
Z%glances.outputs.glances_stdout_apidocrZglances.outdatedrZ
glances.timerr
�objectrr#r#r#r$�<module>
s