HEX
Server: LiteSpeed
System: Linux kapuas.iixcp.rumahweb.net 5.14.0-427.42.1.el9_4.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Nov 1 14:58:02 EDT 2024 x86_64
User: mirz4654 (1666)
PHP: 8.1.33
Disabled: system,exec,escapeshellarg,escapeshellcmd,passthru,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,popen,pclose,dl,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setsid,posix_setuid,posix_setpgid,ini_alter,show_source,define_syslog_variables,symlink,syslog,openlog,openlog,closelog,ocinumcols,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dll,ftp,myshellexec,socket_bind,mail,posix_getwpuid
Upload Files
File: //usr/lib/python3.9/site-packages/tuned/units/__pycache__/manager.cpython-39.pyc
a

,�g��@s�ddlZddlZddlZddlZddlZddlZddlZddlm	Z	ddl
mZddlm
Z
ej��ZdgZGdd�de�ZdS)�N)�GlobalConfig)�commands�Managercs�eZdZdZd�fdd�	Zedd��Zedd��Zed	d
��Zdd�Z	d
d�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zejfdd�Z�ZS) rz?
	Manager creates plugin instances and keeps a track of them.
	NcsJtt|���||_||_||_||_g|_g|_|p:t	�|_
t�|_dS�N)
�superr�__init__�_plugins_repository�_monitors_repository�_def_instance_priority�_hardware_inventory�
_instances�_pluginsr�_configr�_cmd)�self�plugins_repositoryZmonitors_repositoryZdef_instance_priorityZhardware_inventoryZconfig��	__class__��7/usr/lib/python3.9/site-packages/tuned/units/manager.pyrszManager.__init__cCs|jSr)r
�rrrr�plugins!szManager.pluginscCs|jSr)rrrrr�	instances%szManager.instancescCs|jSr)rrrrrr)szManager.plugins_repositorycCsF|jdurdS|j�tj�}|dur0|j�d�}t�|j|tj	�duS)NTz
/proc/cpuinfo)
Z
cpuinfo_regexr�get�constsZCFG_CPUINFO_STRINGrZ	read_file�re�search�	MULTILINE)r�unitZcpuinfo_stringrrr�_unit_matches_cpuinfo-s

��zManager._unit_matches_cpuinfocCsH|jdurdS|j�tj�}|dur2d�t���}t�	|j|tj
�duS)NT� )Zuname_regexrrrZCFG_UNAME_STRING�join�os�unamerrr)rrZuname_stringrrr�_unit_matches_uname6s

��zManager._unit_matches_unamec
Cs"g}t|���D]�\}}|js.t�d|�q|�|�sHt�d|�q|�|�sbt�d|�q|jdurzt|j	�|_nt|j�|_|�
|�q|jdd�d�t�
�}|D]}d||j<q�t|���D]�\}}z$|j�|�}|||<|j�
|�Wq�tjjj�y"t�d|�Yq�Yq�t�yj}	z0t�d|�t�|	�WYd}	~	q�WYd}	~	q�d}	~	00q�g}
|D]b}||j}|du�r��qvt�d	|j|jf�|�|j|j|j|j|j|j|j �}|
�
|��qv|
D](}|j!�"�|j!�#|�|j!�$|��q�|j%�&�|j'�(|
�dS)
Nzskipping disabled instance '%s'z.skipping instance '%s', cpuinfo does not matchz,skipping instance '%s', uname does not matchcSs|jSr)�priority)�xrrr�<lambda>R�z Manager.create.<locals>.<lambda>)�keyz2skipping plugin '%s', not supported on your systemzfailed to initialize plugin %szcreating '%s' (%s)))�list�itemsZenabled�log�debugrr$r%�intr
�append�sort�collections�OrderedDict�typer�creater
�tunedr�
exceptionsZNotSupportedPluginException�info�	Exception�error�	exception�nameZcreate_instanceZdevicesZdevices_udev_regexZ
script_preZscript_post�options�pluginZinit_devicesZassign_free_devicesZinitialize_instancerZstart_processing_eventsr�extend)
rZinstances_configZinstance_info_listZ
instance_nameZ
instance_infoZplugins_by_nameZplugin_nameZnoner=�erZnew_instance�instancerrrr4?s`



$

�

zManager.createc
Osfz||i|��WSty`}z8t��}t�d|t|�f�t�|�|WYd}~Sd}~00dS)Nz"BUG: Unhandled exception in %s: %s)r8�	traceback�
format_excr,r9�str)rZcallerZexc_ret�f�args�kwargsr?Ztracerrr�	_try_callws
�
zManager._try_callcCs�|jD](}t�d|j�|�dd|jj|�q|jD]$}t�d|j�|�dd|j�q6|j	j
��|jdd�=|jdd�=dS)Nzdestroying instance %s�destroy_allzcleaning plugin '%s')rr,r-r;rGr=Zdestroy_instancer
Zcleanuprr�clear)rr@r=rrrrH�s
�
zManager.destroy_allcCs0|jjD]"}t�d|�|�dd|j�qdS)Nzupdating monitor %s�update_monitors)r	Zmonitorsr,r-rG�update)rZmonitorrrrrJ�szManager.update_monitorscCs |jD]}|�dd|j�qdS)N�start_tuning)rrGZapply_tuning�rr@rrrrL�s
�zManager.start_tuningcCs2d}|jD]"}|�dd|j|�}|dkr
d}q
|S)NT�
verify_tuningF)rrGrN)rZignore_missing�retr@�resrrrrN�s
�zManager.verify_tuningcCs |jD]}|�dd|j�qdS)N�
update_tuning)rrGrQrMrrrrQ�s
�zManager.update_tuningcCs0|j��t|j�D]}|�dd|j|�qdS)N�stop_tuning)rZstop_processing_events�reversedrrGZunapply_tuning)rZrollbackr@rrrrR�s

�zManager.stop_tuning)N)�__name__�
__module__�__qualname__�__doc__r�propertyrrrrr$r4rGrHrJrLrNrQrZ
ROLLBACK_SOFTrR�
__classcell__rrrrrs&�


		8

	
)r1r"rrAZtuned.exceptionsr5Z
tuned.logsZtuned.plugins.exceptionsZtuned.constsrZtuned.utils.global_configrZtuned.utils.commandsrZlogsrr,�__all__�objectrrrrr�<module>s