3 ܓi@s2ddlZddlmZmZmZGdddeeZdS)N)PluginIndependentPlugin PluginOptc@sXeZdZdZdZdZdZdZdZe dde dde d d e d de d d ddgZ 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. instructlabaiilabz ilab-userz cloud-userzuser that runs instructlab)defaultZval_typedescz ilab-conf-dirzinstructlab data directoryz get-cacheFz#Capture models and osci cached data)r r cs*d}d}d}d}d}j||}j||}j||jjdjdj|dj|d gd d d d dg}dddddddddg } yjddd} Wntk rd} YnXj|d|dg| djfdd| D| djd d|D| dj|d!| d"jd#r>j|| djt j jd$} yt j | } Wn(t k rjd%| d&dSX| r&| j} jd'rj| jd'} j| |jj| |jfd(d| Djj| |d!d)jd#r&jj| |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/.githubz taxonomy diffz#taxonomy diff --taxonomy-base=emptyz system infoz model listz config showdataZ generatedZtaxonomyZ taxonomy_dataZchatlogsZ checkpointsZdatasetsZinternalZphasedz instructlab*rz/rhel_ai_config.yamlz /config.yaml) containercsg|]}j|qS) path_join).0data_dir)cont_local_pathselfr!/usr/lib/python3.6/instructlab.py gsz%Instructlab.setup..cSsg|]}d|qS)zilab r)rsubrrrrlsT) recursiverz get-cachez ilab-userzUser "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 Instructlabz ilab-conf-dircsg|]}j|qSr)r)rr)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_path cache_dirZ config_dirZlocal_share_dirZcont_cache_pathZcont_config_pathZsubcmdsZ data_dirsZilab_conZ ilab_userZuser_pwdZilab_dirr)rrrrsetup)s                 zInstructlab.setupN)r)rr)r) __name__ __module__ __qualname____doc__Z short_descZ plugin_nameZprofilesrZcommandsrstrZ option_listr"rrrrrs  r)rZsos.report.pluginsrrrrrrrr s