Skip to content

Commit e7d14a9

Browse files
Fix two bugs for preflight check (#1267)
* Fix two bugs * Update package_checker.py
1 parent 4ae7707 commit e7d14a9

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

nvflare/tool/package_checker/package_checker.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def init_rules(self, package_path: str):
3939
def init(self, package_path: str):
4040
if not os.path.exists(package_path):
4141
raise RuntimeError(f"Package path: {package_path} does not exist.")
42-
self.package_path = package_path
42+
self.package_path = os.path.abspath(package_path)
4343
self.init_rules(package_path)
4444

4545
@abstractmethod
@@ -54,8 +54,8 @@ def get_dry_run_command(self) -> str:
5454
def stop_dry_run(self, force: bool = True):
5555
# todo: add gracefully shutdown command, currently
5656
print("killing dry run process")
57-
58-
cmd = f"pkill -9 -f '{self.package_path}'"
57+
command = self.get_dry_run_command()
58+
cmd = f"pkill -9 -f '{command}'"
5959
process = run_command_in_subprocess(cmd)
6060
process.wait()
6161

nvflare/tool/package_checker/server_package_checker.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,19 +54,19 @@ def _get_job_storage_root(package_path: str) -> str:
5454
return job_storage_root
5555

5656

57-
def _get_grpc_host_and_port(package_path: str):
57+
def _get_grpc_host_and_port(package_path: str) -> (str, int):
5858
fed_config = _get_server_fed_config(package_path)
5959
server_conf = fed_config["servers"][0]
6060
grpc_service_config = server_conf["service"]
6161
grpc_target_address = grpc_service_config["target"]
62-
host, port = grpc_target_address.split(":")
63-
return host, int(port)
62+
_, port = grpc_target_address.split(":")
63+
return "localhost", int(port)
6464

6565

66-
def _get_admin_host_and_port(package_path: str):
66+
def _get_admin_host_and_port(package_path: str) -> (str, int):
6767
fed_config = _get_server_fed_config(package_path)
6868
server_conf = fed_config["servers"][0]
69-
return server_conf["admin_host"], int(server_conf["admin_port"])
69+
return "localhost", int(server_conf["admin_port"])
7070

7171

7272
class ServerPackageChecker(PackageChecker):
@@ -103,8 +103,8 @@ def get_dry_run_command(self) -> str:
103103
self.job_storage_root = _get_job_storage_root(self.package_path)
104104
return command
105105

106-
def stop_dry_run(self):
107-
super().stop_dry_run()
106+
def stop_dry_run(self, force=True):
107+
super().stop_dry_run(force=force)
108108
if os.path.exists(self.snapshot_storage_root):
109109
shutil.rmtree(self.snapshot_storage_root)
110110
if os.path.exists(self.job_storage_root):

0 commit comments

Comments
 (0)