enable debug data and all data in config

This commit is contained in:
Xu Yang
2024-07-15 10:23:32 +00:00
parent ef0dc083a8
commit 93362ba747
6 changed files with 27 additions and 24 deletions
+2 -2
View File
@@ -8,10 +8,10 @@ class ModelImplSettings(BaseSettings):
class Config:
env_prefix = "MODEL_IMPL_" # Use MODEL_IMPL_ as prefix for environment variables
file_based_execution_workspace: str = str(
model_execution_workspace: str = str(
(Path().cwd() / "git_ignore_folder" / "model_implementation_workspace").absolute(),
)
implementation_execution_cache_location: str = str(
model_cache_location: str = str(
(Path().cwd() / "git_ignore_folder" / "model_implementation_execution_cache").absolute(),
)
@@ -68,7 +68,7 @@ class ModelImplementation(FBImplementation):
Prepare for the workspace;
"""
unique_id = uuid.uuid4()
self.workspace_path = Path(MODEL_IMPL_SETTINGS.file_based_execution_workspace) / f"M{unique_id}"
self.workspace_path = Path(MODEL_IMPL_SETTINGS.model_execution_workspace) / f"M{unique_id}"
# start with `M` so that it can be imported via python
self.workspace_path.mkdir(parents=True, exist_ok=True)
@@ -84,10 +84,8 @@ class ModelImplementation(FBImplementation):
if MODEL_IMPL_SETTINGS.enable_execution_cache:
# NOTE: cache the result for the same code
target_file_name = md5_hash(self.code_dict["model.py"])
cache_file_path = (
Path(MODEL_IMPL_SETTINGS.implementation_execution_cache_location) / f"{target_file_name}.pkl"
)
Path(MODEL_IMPL_SETTINGS.implementation_execution_cache_location).mkdir(exist_ok=True, parents=True)
cache_file_path = Path(MODEL_IMPL_SETTINGS.model_cache_location) / f"{target_file_name}.pkl"
Path(MODEL_IMPL_SETTINGS.model_cache_location).mkdir(exist_ok=True, parents=True)
if cache_file_path.exists():
return pickle.load(open(cache_file_path, "rb"))
mod = get_module_by_module_path(str(self.workspace_path / "model.py"))