diff --git a/openfl-docker/gramine_app/fx.manifest.template b/openfl-docker/gramine_app/fx.manifest.template index 928dff0f56..55e20adf42 100755 --- a/openfl-docker/gramine_app/fx.manifest.template +++ b/openfl-docker/gramine_app/fx.manifest.template @@ -64,6 +64,7 @@ sgx.trusted_files = [ # One should be conservative as to which files are allowed, these can be modified by enclave. sgx.allowed_files = [ "file:{{ workspace_root }}/save", + "file:{{ workspace_root }}/local_state", "file:{{ workspace_root }}/logs", "file:{{ workspace_root }}/cert", "file:{{ workspace_root }}/data", diff --git a/openfl-workspace/workspace/plan/defaults/aggregator.yaml b/openfl-workspace/workspace/plan/defaults/aggregator.yaml index d4204e2b0c..9fc0481f29 100644 --- a/openfl-workspace/workspace/plan/defaults/aggregator.yaml +++ b/openfl-workspace/workspace/plan/defaults/aggregator.yaml @@ -2,4 +2,4 @@ template : openfl.component.Aggregator settings : db_store_rounds : 2 persist_checkpoint: True - persistent_db_path: save/tensor.db + persistent_db_path: local_state/tensor.db diff --git a/openfl/component/aggregator/aggregator.py b/openfl/component/aggregator/aggregator.py index 4b3ff2680c..c6829e75b9 100644 --- a/openfl/component/aggregator/aggregator.py +++ b/openfl/component/aggregator/aggregator.py @@ -1076,7 +1076,7 @@ def _compute_validation_related_task_metrics(self, task_name) -> dict: # FIXME: Configurable logic for min/max criteria in saving best. if "validate_agg" in tags: - # Compare the accuracy of the model, potentially save it + # Compare the accuracy of the model, potentially save it. if self.best_model_score is None or self.best_model_score < agg_results: logger.info( f"Round {round_number}: saved the best model with score {agg_results:f}" diff --git a/openfl/interface/interactive_api/experiment.py b/openfl/interface/interactive_api/experiment.py index cc3ffae3b2..0a9b383b2f 100644 --- a/openfl/interface/interactive_api/experiment.py +++ b/openfl/interface/interactive_api/experiment.py @@ -103,6 +103,7 @@ def _initialize_plan(self): # Create a folder to store plans os.makedirs("./plan", exist_ok=True) os.makedirs("./save", exist_ok=True) + os.makedirs("./local_state", exist_ok=True) # Load the default plan base_plan_path = WORKSPACE / "workspace/plan/plans/default/base_plan_interactive_api.yaml" plan = Plan.parse(base_plan_path, resolve=False) diff --git a/openfl/interface/workspace.py b/openfl/interface/workspace.py index dce6eb9dae..522ff99b5f 100644 --- a/openfl/interface/workspace.py +++ b/openfl/interface/workspace.py @@ -66,6 +66,7 @@ def create_dirs(prefix): (prefix / "data").mkdir(parents=True, exist_ok=True) # training data (prefix / "logs").mkdir(parents=True, exist_ok=True) # training logs (prefix / "save").mkdir(parents=True, exist_ok=True) # model weight saves / initialization + (prefix / "local_state").mkdir(parents=True, exist_ok=True) # persistent state (prefix / "src").mkdir(parents=True, exist_ok=True) # model code shutil.copyfile(WORKSPACE / "workspace" / ".workspace", prefix / ".workspace") @@ -354,6 +355,7 @@ def export_() -> str: # os.makedirs(os.path.join(tmp_dir, 'save'), exist_ok=True) os.makedirs(os.path.join(tmp_dir, "logs"), exist_ok=True) os.makedirs(os.path.join(tmp_dir, "data"), exist_ok=True) + os.makedirs(os.path.join(tmp_dir, "local_state"), exist_ok=True) shutil.copytree("src", os.path.join(tmp_dir, "src"), ignore=ignore) shutil.copytree("plan", os.path.join(tmp_dir, "plan"), ignore=ignore) shutil.copytree("save", os.path.join(tmp_dir, "save")) diff --git a/tests/openfl/federated/plan/plan_example.yaml b/tests/openfl/federated/plan/plan_example.yaml index af976f3f43..8afe672b11 100644 --- a/tests/openfl/federated/plan/plan_example.yaml +++ b/tests/openfl/federated/plan/plan_example.yaml @@ -9,6 +9,7 @@ aggregator : best_state_path : save/best.pbuf last_state_path : save/last.pbuf rounds_to_train : 10 + persistent_db_path: tensor.db collaborator : defaults : plan/defaults/collaborator.yaml