Skip to content

Commit

Permalink
Fixed the args.log_config setting. (#86)
Browse files Browse the repository at this point in the history
* Fixed the args.log_config setting.

* Enhanced to allow FL app config/log.config to overwrite the settings.
  • Loading branch information
yhwen authored Jan 5, 2022
1 parent 5a478c3 commit 5316ed4
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions nvflare/private/fed/app/client/worker_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@

"""Provides a command line interface for a federated client trainer"""

import traceback

import argparse
import os
import sys
import traceback

from nvflare.apis.fl_constant import FLContextKey
from nvflare.apis.workspace import Workspace
Expand Down Expand Up @@ -57,7 +56,6 @@ def main():
args.client_config = os.path.join(config_folder, "config_fed_client.json")
args.config_folder = config_folder
args.env = os.path.join("config", "environment.json")
args.log_config = None

try:
remove_restart_file(args)
Expand Down Expand Up @@ -90,12 +88,19 @@ def main():
)
)

workspace = os.path.join("/tmp/fl", client_name) # TODO: find a way to replace "/tmp/fl"
workspace = os.path.join("/tmp/fl", client_name)
app_root = os.path.join(args.workspace, "run_" + str(run_number), "app_" + client_name)

app_log_config = os.path.join(app_root, config_folder, "log.config")
if os.path.exists(app_log_config):
args.log_config = app_log_config
else:
args.log_config = os.path.join(workspace, "log.config")

conf = FLClientStarterConfiger(
app_root=workspace,
client_config_file_name=args.fed_client,
log_config_file_name=os.path.join(workspace, "log.config"),
log_config_file_name=args.log_config,
kv_list=args.set,
)
conf.configure()
Expand All @@ -110,8 +115,6 @@ def main():
federated_client.fl_ctx.set_prop(EngineConstant.FL_TOKEN, token, private=False)
federated_client.fl_ctx.set_prop(FLContextKey.WORKSPACE_ROOT, args.workspace, private=True)

app_root = os.path.join(args.workspace, "run_" + str(run_number), "app_" + client_name)

client_config_file_name = os.path.join(app_root, args.client_config)
conf = ClientJsonConfigurator(
config_file_name=client_config_file_name,
Expand Down

0 comments on commit 5316ed4

Please sign in to comment.