diff --git a/nvflare/private/fed/app/client/sub_worker_process.py b/nvflare/private/fed/app/client/sub_worker_process.py index e0d5711ee4..aeb6d297aa 100644 --- a/nvflare/private/fed/app/client/sub_worker_process.py +++ b/nvflare/private/fed/app/client/sub_worker_process.py @@ -18,7 +18,6 @@ import copy import logging import os -import sys import threading import time @@ -310,9 +309,6 @@ def stop(self): def main(args): workspace = Workspace(args.workspace, args.client_name) - 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) fobs_initialize(workspace=workspace, job_id=args.job_id) diff --git a/nvflare/private/fed/app/simulator/simulator_runner.py b/nvflare/private/fed/app/simulator/simulator_runner.py index ef61de3a2f..a7f38138fb 100644 --- a/nvflare/private/fed/app/simulator/simulator_runner.py +++ b/nvflare/private/fed/app/simulator/simulator_runner.py @@ -670,6 +670,10 @@ def do_one_task(self, client, num_of_threads, gpu, lock, timeout=60.0, task_name name=ConfigVarName.DECOMPOSER_MODULE, conf=SystemConfigs.RESOURCES_CONF ) + app_custom_folder = Workspace(root_dir=client_workspace, site_name="mgh").get_app_custom_dir( + SimulatorConstants.JOB_NAME + ) + command = ( sys.executable + " -m nvflare.private.fed.app.simulator.simulator_worker -o " @@ -698,7 +702,7 @@ def do_one_task(self, client, num_of_threads, gpu, lock, timeout=60.0, task_name if gpu: command += " --gpu " + str(gpu) new_env = os.environ.copy() - new_env["PYTHONPATH"] = os.pathsep.join(self._get_new_sys_path()) + new_env["PYTHONPATH"] = os.pathsep.join(self._get_new_sys_path()) + os.pathsep + app_custom_folder _ = subprocess.Popen(shlex.split(command, True), preexec_fn=os.setsid, env=new_env)