File: //lib/python3.9/site-packages/sos/report/plugins/__pycache__/instructlab.cpython-39.opt-1.pyc
a
\��h� � @ s2 d dl Z d dlmZmZmZ G dd� dee�ZdS )� N)�Plugin�IndependentPlugin� PluginOptc @ sX e Zd ZdZd ZdZdZdZdZe dde
dd �e d
de
dd �e d
ddd�gZdd� ZdS )�InstructlabaL
This plugin is used to capture information about
Instructlab installations.
InstructLab is an open source project for enhancing
large language models (LLMs) used in generative
artificial intelligence (gen AI) applications.
Instructlab can run either as a container, or directly
outside a container.
�instructlab)Zai)r �ilab)r � ilab-userz
cloud-userzuser that runs instructlab)�defaultZval_type�desc�
ilab-conf-dir� zinstructlab data directory� get-cacheFz#Capture models and osci cached data)r r
c s d}d}d}d}d}�� ||�}�� ||�}�� ||�� ���� � d��� � d��� |d��� |d �g� g d
�}g d�} z��d�d
d }
W n ty� d }
Y n0 �j|� d�|� d�g|
d� �j� �fdd�| D �|
d� �jdd� |D �|
d� �j|d|
d� ��d��r(�j|� |
d� ��t �j
�� ��d�}zt�|�}W n( t
�yx ��d|� d�� Y d S 0 |�r|j}
��d��r��� |
��d��}
�� |
|������ |
|�� ����fdd�| D �� �j�� |
|�dd� ��d��r���� |
|�� d S )Nz/usr/share/instructlab/configz/opt/app-root/srcz.cache/instructlabz.config/instructlabz.local/share/instructlabz
taxonomy/.gitztaxonomy/.githubz*src/.local/share/instructlab/taxonomy/.gitz-src/.local/share/instructlab/taxonomy/.github)z
taxonomy diffz#taxonomy diff --taxonomy-base=emptyzsystem infoz
model listzconfig show) �dataZ generatedZtaxonomyZ
taxonomy_dataZchatlogsZcheckpointsZdatasetsZinternalZphasedzinstructlab*r � z/rhel_ai_config.yamlz/config.yaml)� containerc s g | ]}�� � |��qS � �� path_join��.0Zdata_dir)�cont_local_path�selfr �B/usr/lib/python3.9/site-packages/sos/report/plugins/instructlab.py�
<listcomp>g s �z%Instructlab.setup.<locals>.<listcomp>c S s g | ]}d |� ��qS )zilab r )r �subr r r r l � T)� recursiver r
r zUser "z�" does not exist, will not collect Instructlab information. Use `-k instructlab.ilab-user` option to define the user to use to collect data for Instructlabr c s g | ]}�� � |��qS r r r )�data_dirs_baser r r r � s �)r )r Zadd_forbidden_pathZget_all_containers_by_regex� ExceptionZ
add_copy_specZadd_cmd_outputZadd_dir_listingZ
get_optionZadd_container_logs�list�
containers�pwd�getpwnam�KeyErrorZ _log_warn�pw_dir)r Zcont_share_conf_pathZ
cont_opt_pathZ cache_dirZ
config_dirZlocal_share_dirZcont_cache_pathZcont_config_pathZsubcmdsZ data_dirsZilab_conZ ilab_userZuser_pwdZilab_dirr )r r r r �setup) s� �
���
�������
�
��
�
�zInstructlab.setupN)
�__name__�
__module__�__qualname__�__doc__Z
short_descZplugin_nameZprofilesr Zcommandsr �strZoption_listr% r r r r r s"