Skip to content

Commit

Permalink
Changed back the workspace.get_client_custom_dir(), fixed the sub_wor…
Browse files Browse the repository at this point in the history
…ker_process app_custom_folder.
  • Loading branch information
yhwen committed Aug 12, 2024
1 parent 89d75ac commit 23182f7
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions nvflare/apis/workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ def get_job_meta_path(self, job_id: str) -> str:
def get_site_privacy_file_path(self):
return self.get_file_path_in_site_config(WorkspaceConstants.PRIVACY_CONFIG)

def get_client_custom_dir(self, job_id: str) -> str:
return os.path.join(self.get_app_dir(job_id), WorkspaceConstants.CUSTOM_FOLDER_NAME)
def get_client_custom_dir(self) -> str:
return os.path.join(self.get_site_config_dir(), WorkspaceConstants.CUSTOM_FOLDER_NAME)

def get_stats_pool_summary_path(self, job_id: str, prefix=None) -> str:
file_name = WorkspaceConstants.STATS_POOL_SUMMARY_FILE_NAME
Expand Down
6 changes: 6 additions & 0 deletions nvflare/fuel/hci/client/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import os
import re
import sys

from nvflare.apis.workspace import Workspace
from nvflare.fuel.common.excepts import ConfigError
Expand All @@ -37,6 +39,10 @@ def __init__(self, workspace: Workspace):
base_pkgs = FL_PACKAGES
module_names = FL_MODULES

custom_dir = workspace.get_client_custom_dir()
if os.path.isdir(custom_dir):
sys.path.append(custom_dir)

admin_config_file_path = workspace.get_admin_startup_file_path()
config_files = [admin_config_file_path]
resources_file_path = workspace.get_resources_file_path()
Expand Down
2 changes: 1 addition & 1 deletion nvflare/private/fed/app/client/sub_worker_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ def stop(self):

def main(args):
workspace = Workspace(args.workspace, args.client_name)
app_custom_folder = workspace.get_client_custom_dir(args.job_id)
app_custom_folder = workspace.get_app_custom_dir(args.job_id)
if os.path.isdir(app_custom_folder) and app_custom_folder not in sys.path:
sys.path.append(app_custom_folder)
configure_logging(workspace)
Expand Down
2 changes: 1 addition & 1 deletion nvflare/private/fed/utils/fed_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ def fobs_initialize(workspace: Workspace = None, job_id: str = None):

def custom_fobs_initialize(workspace: Workspace = None, job_id: str = None):
if workspace:
site_custom_dir = workspace.get_client_custom_dir(job_id)
site_custom_dir = workspace.get_client_custom_dir()
decomposer_dir = os.path.join(site_custom_dir, ConfigVarName.DECOMPOSER_MODULE)
if os.path.exists(decomposer_dir):
register_custom_folder(decomposer_dir)
Expand Down

0 comments on commit 23182f7

Please sign in to comment.