a >h@s2ddlZddlmZmZmZGdddeeZdS)N)PluginIndependentPlugin PluginOptc@sXeZdZdZdZdZdZdZdZe dde dd e d d e d d e d dddgZ ddZ dS) 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)rilab)r ilab-userz cloud-userzuser that runs instructlab)defaultZval_typedesc ilab-conf-dirzinstructlab data directory get-cacheFz#Capture models and osci cached data)r r c sd}d}d}d}d}||}||}||dd|d|d ggd }gd } zd d d} Wntyd} Yn0j|d|dg| djfdd| D| djdd|D| dj|d| ddr(j|| dt j d} zt | } Wn(t yxd| dYdS0| r| j} dr| d} | || |fdd| Dj| |dddr| |dS)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=emptyz system infoz model listz config show) dataZ generatedZtaxonomyZ taxonomy_dataZchatlogsZ checkpointsZdatasetsZinternalZphasedz instructlab*rz/rhel_ai_config.yamlz /config.yaml) containercsg|]}|qS path_join.0Zdata_dir)cont_local_pathselfrB/usr/lib/python3.9/site-packages/sos/report/plugins/instructlab.py gsz%Instructlab.setup..cSsg|]}d|qS)zilab r)rsubrrrrlT) recursiverr rzUser "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 csg|]}|qSrrr)data_dirs_baserrrrs)r)rZadd_forbidden_pathZget_all_containers_by_regex ExceptionZ add_copy_specZadd_cmd_outputZadd_dir_listingZ get_optionZadd_container_logslist containerspwdgetpwnamKeyErrorZ _log_warnpw_dir)rZcont_share_conf_pathZ cont_opt_pathZ cache_dirZ config_dirZlocal_share_dirZcont_cache_pathZcont_config_pathZsubcmdsZ data_dirsZilab_conZ ilab_userZuser_pwdZilab_dirr)rrrrsetup)s                   zInstructlab.setupN) __name__ __module__ __qualname____doc__Z short_descZ plugin_nameZprofilesr ZcommandsrstrZ option_listr%rrrrrs"  r)r!Zsos.report.pluginsrrrrrrrr s