Sindbad~EG File Manager

Current Path : /lib/python3.6/site-packages/sos/report/plugins/__pycache__/
Upload File :
Current File : //lib/python3.6/site-packages/sos/report/plugins/__pycache__/slurm.cpython-36.pyc

3

�f�@s8ddlmZmZmZddlmZGdd�deee�ZdS)�)�Plugin�UbuntuPlugin�RedHatPlugin)�
is_executablec@s0eZdZdZdZdZdZdZdd�Zd
d�Z	dS)�SlurmzSlurm Workload Manager�slurm�hpc�	slurm-wlm�slurmd�slurmdbd�	slurmctld�slurm-slurmctld�slurm-slurmd�slurm-slurmdbdc	Cs�|jddg�td�r$|jddg�td�r8|jdg�dd	d
ddd
dddddddddddg}td�rz|jdd�|D��d}|j|�s�d}d}d}y|t|d d!d"��d}x\|j�j�D]L}|s�q�|jd#�}|d$j�d%kr�|d&j�}|d$j�d'kr�|d&j�}q�WWd(QRXWn6t	k
�rF}z|j
d)||f�WYd(d(}~XnX|jd*��sd|j||g�n|j|�d+�|�d+�g�d(S),z  Slurm Workload Manager
        z/etc/slurm/*.confz/var/run/slurm/conf/*.confZsinfoz!sinfo --all --list-reasons --longzsinfo --all --longZsqueuezsqueue --all --long�aliasesZ	assoc_mgrZbbstatZburstBuffer�configZdaemonsZdwstatZ
federationZfrontendZjobZlicensesZnode�	partitionZreservationr
�stepZtopologyZscontrolcSsg|]}d|���qS)zscontrol show �)�.0�irr�/usr/lib/python3.6/slurm.py�
<listcomp>OszSlurm.setup.<locals>.<listcomp>z/etc/slurm/slurm.confz/var/run/slurm/conf/slurm.confz/var/log/slurmd.logz/var/log/slurmctld.log�rzUTF-8)�encoding�=rZ
SlurmdLogFile�ZSlurmctldLogFileNzCould not open conf file %s: %sZall_logs�*)Z
add_copy_specrZadd_cmd_outputZpath_exists�open�read�
splitlines�split�strip�IOErrorZ
_log_errorZ
get_option)	�selfZ
scontrol_cmdsZconfig_fileZslurmd_log_fileZslurmctld_log_file�cfile�lineZwords�errorrrr�setup%sn


zSlurm.setupcCs`ddg}ddg}ddj|�}d}d}x4|D],}|j|�d	�||�|j|�d
�||�q,WdS)Nz
/etc/slurmz/var/run/slurm/confZAccountingStoragePassZJobCompPassz(^\s*(%s)\s*=\s*)(.*)�|z(^\s*(StoragePass)\s*=\s*)(.*)z
\1********z/slurm.confz/slurmdbd.conf)�joinZdo_file_sub)r$Z
conf_pathsZ
slurm_keysZslurm_keys_regexZslurmdbd_key_regex�subZ	conf_pathrrr�postprocss
zSlurm.postprocN)r)r	r
rrrr
rr)r
rr)
�__name__�
__module__�__qualname__Z
short_descZplugin_nameZprofilesZpackagesZservicesr(r,rrrrr
s NrN)Zsos.report.pluginsrrrZ
sos.utilitiesrrrrrr�<module>	s

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists