nvflare.tool.package_checker.utils module

class NVFlareConfig[source]

Bases: object

ADMIN = 'fed_admin.json'
CLIENT = 'fed_client.json'
SERVER = 'fed_server.json'
class NVFlareRole[source]

Bases: object

ADMIN = 'admin'
CLIENT = 'client'
SERVER = 'server'
check_grpc_server_running(startup: str, host: str, port: int, token=None) bool[source]
check_socket_server_running(startup: str, host: str, port: int, scheme: str = 'https') bool[source]

Check if socket-based server (HTTP/HTTPS/TCP/STCP) is running and accessible.

This function performs a socket connection test with optional SSL/TLS. It’s used for HTTP/WebSocket and TCP-based FL servers.

Parameters:
  • startup – Path to startup directory containing certificates

  • host – Server hostname or IP address

  • port – Server port number

  • scheme – URL scheme (“http”, “https”, “tcp”, “stcp”)

Returns:

True if server is accessible, False otherwise

get_communication_scheme(package_path: str, config_name: str, default_scheme: str = 'http') str[source]

Read the communication scheme from package configuration files.

This function checks multiple sources to determine the communication scheme: 1. For servers: fed_server.json (service.scheme) 2. For all packages: comm_config.json in local/ or startup/ directories

Parameters:
  • package_path – Path to the package directory

  • config_name – Name of the configuration file (fed_server.json, fed_client.json, fed_admin.json)

  • default_scheme – Default scheme to return if no scheme is found

Returns:

The communication scheme (e.g., “grpc”, “http”)

run_command_in_subprocess(command)[source]
split_by_len(item, max_len)[source]
try_bind_address(host: str, port: int)[source]

Tries to bind to address.

try_write_dir(path: str)[source]