fix: Use fixed file name in model costeer & fixing cache (#311)

* use fixed name in model costeer to enable cache

* fix ci
This commit is contained in:
Way2Learn
2024-09-24 14:50:01 +08:00
committed by GitHub
parent b6722997b1
commit 36bfbf20b6
2 changed files with 3 additions and 1 deletions
@@ -115,6 +115,7 @@ PARAM_INIT_VALUE = {param_init_value}
dump_file_names=["execution_feedback_str.pkl", "execution_model_output.pkl"],
local_path=str(self.workspace_path),
env={},
code_dump_file_py_name="model_test",
)
if results is None:
raise RuntimeError(f"Error in running the model code: {log}")
+2 -1
View File
@@ -327,11 +327,12 @@ class DockerEnv(Env[DockerConf]):
local_path: str | None = None,
env: dict | None = None,
running_extra_volume: dict | None = None,
code_dump_file_py_name: Optional[str] = None,
):
"""
Dump the code into the local path and run the code.
"""
random_file_name = f"{uuid.uuid4()}.py"
random_file_name = f"{uuid.uuid4()}.py" if code_dump_file_py_name is None else f"{code_dump_file_py_name}.py"
with open(os.path.join(local_path, random_file_name), "w") as f:
f.write(code)
entry = f"python {random_file_name}"