Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed the wrong workspace object in the simulator worker #2429

Merged
merged 3 commits into from
Mar 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading