Skip to content

Commit

Permalink
Merge branch 'main' into docker_job_launcher
Browse files Browse the repository at this point in the history
  • Loading branch information
chesterxgchen authored Dec 4, 2024
2 parents c092943 + d249ef7 commit 05bdd01
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 7 deletions.
7 changes: 7 additions & 0 deletions nvflare/lighter/impl/static_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,13 @@ def prepare_admin_config(self, admin, ctx):
agent_config = dict()
self._prepare_overseer_agent(admin, agent_config, "admin", ctx)
config["admin"].update(agent_config)

provision_mode = ctx.get("provision_mode")
if provision_mode == "poc":
# in poc mode, we change to use "local_cert" as the cred_type so that the user won't be
# prompted for username when starting the admin console
config["admin"]["username"] = admin.name
config["admin"]["cred_type"] = "local_cert"
return config

def build(self, project, ctx):
Expand Down
6 changes: 5 additions & 1 deletion nvflare/lighter/spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,12 +246,16 @@ def _prepare_workspace(self, ctx):
dirs = [workspace, resources_dir, wip_dir, state_dir]
self._make_dir(dirs)

def provision(self, project: Project):
def provision(self, project: Project, mode=None):
# ctx = {"workspace": os.path.join(self.root_dir, project.name), "project": project}
workspace = os.path.join(self.root_dir, project.name)
ctx = {"workspace": workspace} # project is more static information while ctx is dynamic
self._prepare_workspace(ctx)
ctx["project"] = project

if mode:
ctx["provision_mode"] = mode

try:
for b in self.builders:
b.initialize(ctx)
Expand Down
5 changes: 3 additions & 2 deletions nvflare/private/fed/app/simulator/simulator_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -708,9 +708,10 @@ def do_one_task(self, client, num_of_threads, gpu, lock, timeout=60.0, task_name
command += " --gpu " + str(gpu)
new_env = os.environ.copy()
add_custom_dir_to_path(app_custom_folder, new_env)
if self.server_custom_folder:
if os.path.isdir(self.server_custom_folder):
python_paths = new_env[SystemVarName.PYTHONPATH].split(os.pathsep)
python_paths.remove(self.server_custom_folder)
if self.server_custom_folder in python_paths:
python_paths.remove(self.server_custom_folder)
new_env[SystemVarName.PYTHONPATH] = os.pathsep.join(python_paths)

_ = subprocess.Popen(shlex.split(command, True), preexec_fn=os.setsid, env=new_env)
Expand Down
3 changes: 2 additions & 1 deletion nvflare/tool/poc/poc_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,9 @@ def local_provision(
service_config = get_service_config(project_config)
project = prepare_project(project_config)
builders = prepare_builders(project_config)

provisioner = Provisioner(workspace, builders)
provisioner.provision(project)
provisioner.provision(project, mode="poc")

return project_config, service_config

Expand Down
7 changes: 4 additions & 3 deletions web/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 05bdd01

Please sign in to comment.