Ai
23 Star 56 Fork 90

openEuler/hpcrunner
关闭

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
configService.py 1.11 KB
一键复制 编辑 原始数据 按行查看 历史
chunlin 提交于 2025-01-06 20:06 +08:00 . no need to del old meta file
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
from dataService import DataService
from executeService import ExecuteService
from toolService import ToolService
class ConfigService:
def __init__(self):
self.exe = ExecuteService()
self.tool = ToolService()
self.ROOT = os.getcwd()
self.meta_path = os.path.join(self.ROOT, DataService.meta_file)
def switch_config(self, config_file):
print(f"Switch config file to {config_file}")
config_path = os.path.join(self.ROOT, config_file)
if not os.path.isfile(config_path):
print("config_path not found, switch failed.")
return
contents = self.tool.read_file(config_file)
# keys should contains in config
keys = ["DOWNLOAD","DEPENDENCY","ENV","APP","BUILD","RUN"]
for key in keys:
if f"[{key}]" not in contents:
print(f"key [{key}] not found in {config_file}, switch failed.")
return
self.tool.write_file(self.meta_path, config_file.strip())
print("Successfully switched. config file saved in file .meta")
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/openeuler/hpcrunner.git
git@gitee.com:openeuler/hpcrunner.git
openeuler
hpcrunner
hpcrunner
master

搜索帮助