Skip to content

Commit

Permalink
Fixed the wrong workspace object in the simulator worker. (#2429)
Browse files Browse the repository at this point in the history
Co-authored-by: Yuan-Ting Hsieh (謝沅廷) <yuantingh@nvidia.com>
  • Loading branch information
yhwen and YuanTingHsieh authored Mar 20, 2024
1 parent 6e4f444 commit 2c1781c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
6 changes: 5 additions & 1 deletion nvflare/private/fed/app/simulator/simulator_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,7 @@ def __init__(self, args, clients: [], client_config, deploy_args, build_ctx):
self.deploy_args = deploy_args
self.build_ctx = build_ctx
self.kv_list = parse_vars(args.set)
self.logging_config = os.path.join(self.args.workspace, "local", WorkspaceConstants.LOGGING_CONFIG)

self.end_run_clients = []

Expand Down Expand Up @@ -573,10 +574,13 @@ def run_client_thread(self, num_of_threads, gpu, lock, rank, timeout=60):

def do_one_task(self, client, num_of_threads, gpu, lock, timeout=60.0, task_name=RunnerTask.TASK_EXEC):
open_port = get_open_ports(1)[0]
client_workspace = os.path.join(self.args.workspace, SimulatorConstants.JOB_NAME, "app_" + client.client_name)
command = (
sys.executable
+ " -m nvflare.private.fed.app.simulator.simulator_worker -o "
+ self.args.workspace
+ client_workspace
+ " --logging_config "
+ self.logging_config
+ " --client "
+ client.client_name
+ " --token "
Expand Down
11 changes: 4 additions & 7 deletions nvflare/private/fed/app/simulator/simulator_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,15 +231,11 @@ def main(args):
thread = threading.Thread(target=check_parent_alive, args=(parent_pid, stop_event))
thread.start()

log_config_file_path = os.path.join(args.workspace, "startup", WorkspaceConstants.LOGGING_CONFIG)
if not os.path.isfile(log_config_file_path):
log_config_file_path = os.path.join(os.path.dirname(__file__), WorkspaceConstants.LOGGING_CONFIG)
logging.config.fileConfig(fname=log_config_file_path, disable_existing_loggers=False)
workspace = os.path.join(args.workspace, SimulatorConstants.JOB_NAME, "app_" + args.client)
log_file = os.path.join(workspace, WorkspaceConstants.LOG_FILE_NAME)
logging.config.fileConfig(fname=args.logging_config, disable_existing_loggers=False)
log_file = os.path.join(args.workspace, WorkspaceConstants.LOG_FILE_NAME)
add_logfile_handler(log_file)

os.chdir(workspace)
os.chdir(args.workspace)
fobs_initialize()
AuthorizationService.initialize(EmptyAuthorizer())
# AuditService.initialize(audit_file_name=WorkspaceConstants.AUDIT_LOG)
Expand All @@ -263,6 +259,7 @@ def main(args):
def parse_arguments():
parser = argparse.ArgumentParser()
parser.add_argument("--workspace", "-o", type=str, help="WORKSPACE folder", required=True)
parser.add_argument("--logging_config", type=str, help="logging config file", required=True)
parser.add_argument("--client", type=str, help="Client name", required=True)
parser.add_argument("--token", type=str, help="Client token", required=True)
parser.add_argument("--port", type=str, help="Listen port", required=True)
Expand Down

0 comments on commit 2c1781c

Please sign in to comment.