diff --git a/.gitignore b/.gitignore index 71ca34e8505adffc2f0f23ea13fff1ff9b1ea2fe..f1def4adcec1a235eb349b3dacbc1f656707ec67 100644 --- a/.gitignore +++ b/.gitignore @@ -67,4 +67,4 @@ build.sh .meta software/* avg -installed* \ No newline at end of file +installed diff --git a/README.md b/README.md index a9c2180e990447460a9f7181bef8f45ffa197f82..bda24f35d575e771c71f60ad5176ee1160c5e14b 100644 --- a/README.md +++ b/README.md @@ -138,43 +138,49 @@ eg: ./jarvis -l ``` -8.一键生成环境变量(会读取配置文件中的[ENV]字段内容并生成env.sh脚本执行,默认自动生成) +8.查询已安装的软件 + +``` +./jarvis -f xxx +``` + +9.一键生成环境变量(会读取配置文件中的[ENV]字段内容并生成env.sh脚本执行,默认自动生成) ``` ./jarvis -e && source ./env.sh ``` -9.一键编译(会读取配置文件中的[BUILD]字段内容并生成build.sh脚本执行) +10.一键编译(会读取配置文件中的[BUILD]字段内容并生成build.sh脚本执行) ``` ./jarvis -b ``` -10.一键运行(会读取配置文件中的[RUN]字段内容并生成run.sh脚本执行) +11.一键运行(会读取配置文件中的[RUN]字段内容并生成run.sh脚本执行) ``` ./jarvis -r ``` -11.一键性能采集(会读取配置文件中的[PERF]字段内容的perf值) +12.一键性能采集(会读取配置文件中的[PERF]字段内容的perf值) ``` ./jarvis -p ``` -12.一键GPU性能采集(需安装nsys、ncu) +13.一键GPU性能采集(需安装nsys、ncu) ``` ./jarvis -gp ``` -13.一键输出服务器信息(包括CPU、网卡、OS、内存等) +14.一键输出服务器信息(包括CPU、网卡、OS、内存等) ``` ./jarvis -i ``` -14.一键服务器性能评测(包括MPI、OMP、P2P等) +15.一键服务器性能评测(包括MPI、OMP、P2P等) ``` ./jarvis -bench all #运行所有benchmark @@ -183,20 +189,20 @@ eg: ./jarvis -bench gemm #运行矩阵运算 benchmark ``` -15.切换配置(配置文件路径会保存到.meta文件中) +16.切换配置(配置文件路径会保存到.meta文件中) ``` ./jarvis -use XXX.config ``` -16.根据当前配置生成Singularity容器定义文件 +17.根据当前配置生成Singularity容器定义文件 ``` ./jarvis -container docker-hub-address eg: ./jarvis -container openeuler:openeuler ``` -17.其它功能查看(网络检测等) +18.其它功能查看(网络检测等) ``` ./jarvis -h diff --git a/images/wechat-group-qr.png b/images/wechat-group-qr.png index 32e7143e1429f1658a7cac818ccd194b74e29456..bce6c94fa0f1aced0f1c4cad8f397446d5d0749e 100644 Binary files a/images/wechat-group-qr.png and b/images/wechat-group-qr.png differ diff --git a/src/analysisService.py b/src/analysisService.py index 37c7a7566a3242b72cc40a481e632e02d81b0f05..24c230a304bff436e218ccf5ebd50b2cdc35065c 100644 --- a/src/analysisService.py +++ b/src/analysisService.py @@ -80,6 +80,9 @@ class AnalysisService: def remove(self,software_path): self.jinstall.remove(software_path) + + def find(self,content): + self.jinstall.find(content) def install_deps(self): self.jinstall.install_depend() diff --git a/src/installService.py b/src/installService.py index 8ddc78177d361da695f6283e580372ca1a0e2d04..f5543d510806e9ffbcccedd31779c279310adc06 100644 --- a/src/installService.py +++ b/src/installService.py @@ -391,10 +391,13 @@ chmod +x {depend_file} print(f"{i+1}: {remove_list[i]}") self.tool.prt_content("") choice = input(f"find {lens} software, which one do you want to remove?\n") - choice = int(choice) - if choice > lens or choice < 1: - print("Wrong choice!") - return + try: + choice = int(choice) + if choice > lens or choice < 1: + print("invalid choice!") + return + except: + sys.exit("please enter a valid number!") self.set_installed_status(remove_list[choice-1], "0") print("Successfully remove "+software_info) @@ -408,4 +411,16 @@ chmod +x {depend_file} for file in installed_list: file = file.replace(self.SOFTWARE_PATH, 'software') print(file) + + def find(self, content): + self.tool.prt_content(f"Looking for package {content}") + file_list = [d for d in glob(self.SOFTWARE_PATH+'/**', recursive=True)] + flag = False + for file in file_list: + if os.path.isdir(file) and self.is_installed(file): + if content in file: + flag = True + print(f"FOUND: {file}") + if not flag: + print("NOT FOUND") \ No newline at end of file diff --git a/src/jarvis.py b/src/jarvis.py index ca1e15d99cdd02fb59f945045ef9de3512380be0..8e400a7150a67a6ee41e5d79d25f8efa8565e748 100644 --- a/src/jarvis.py +++ b/src/jarvis.py @@ -17,8 +17,10 @@ class Jarvis: parser.add_argument("-l","--list", help=f"get installed package info", action="store_true") #accept software_name/version GCC/GCC+MPI/CLANG/CLANG+MPI parser.add_argument("-install","--install", help=f"install dependency", nargs=2) - #accept software_name/version GCC/GCC+MPI/CLANG/CLANG+MPI + #remove parser.add_argument("-remove","--remove", help=f"remove software", nargs=1) + #find + parser.add_argument("-find","--find", help=f"find software", nargs=1) # dependency install parser.add_argument("-dp","--depend", help=f"{DataService.app_name} dependency install", action="store_true") parser.add_argument("-e","--env", help=f"set environment {DataService.app_name}", action="store_true") @@ -64,6 +66,9 @@ class Jarvis: if self.args.remove: self.analysis.remove(self.args.remove[0]) + if self.args.find: + self.analysis.find(self.args.find[0]) + if self.args.env: self.analysis.env()