12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- import sys
- import os
- import json
- # from lemon_master.mutation_executor import lemon_process
- from lemon_master.run.mutation_executor import lemon_process
- def mock(exp: str, root_dir: str, output_dir: str, mutate_num: int, config_name: str):
- print("running")
- print("exp:", exp)
- print("root_dir:", root_dir)
- print("out_dir:", output_dir)
- print("mutate_num:", mutate_num)
- print("config_name:", config_name)
- data = [
- {
- "model": "lenet5-fashion-mnist",
- "method": "origin0",
- "result": {
- "Losses": 0.3032414233312011,
- "Accuracy": 0.9062593914568424,
- "MemoryInfoList": 1.2329671382904053,
- },
- }
- ]
- return data
- # result_num = 0
- def runtool(
- exp: str, mutate_num: int,task_id:str
- ):
- global result_num
- config_name = "demo.conf"
- base_dir = os.path.dirname(os.path.abspath(__file__))
- print(base_dir)
-
- # result_num = ( result_num + 1 ) % 5
-
- output_dir = os.path.join(base_dir, "output", task_id)
-
- if os.path.exists(output_dir):
- print("remove output_dir:", output_dir)
- # TODO: 正式时需要删除 os.system("rm -rf " + output_dir)
-
- print("running")
- print("exp:", exp)
- print("out_dir:", output_dir)
- print("mutate_num:", mutate_num)
- print("config_name:", config_name)
- root_dir = os.path.join(base_dir, "lemon_master")
-
- target_dir = os.path.join(base_dir, "lemon_master", "run")
- print(target_dir)
- sys.path.append(target_dir)
-
- # 执行任务
- # TODO: 正式时需要注释lemon_process(exp, root_dir, output_dir, mutate_num, config_name)
- lemon_process(exp, root_dir, output_dir, mutate_num, config_name)
- # real_output_dir = os.path.join(output_dir, exp)
-
- # mxnet_json = os.path.join(real_output_dir, "mxnet.json")
- # with open(
- # mxnet_json, "r"
- # ) as file1: # tensorflow.json
- # data1 = json.load(file1)
-
- # tensorflow_json = os.path.join(real_output_dir, "tensorflow.json")
- # with open(tensorflow_json, "r") as file2:
- # data2 = json.load(file2)
-
- # combined_data = {
- # "mxnet": data1,
- # "tensorflow": data2
- # }
- # return combined_data
- return "success"
|