nvflare.app_common.logging.job_log_streamer module
- class JobLogStreamer(log_file_name: str = 'log.txt', liveness_interval: float = 10.0, poll_interval: float = 0.5, target_parent_server: bool = False)[source]
Bases:
WidgetStreams a job log file to the server in real-time.
JobLogStreamertails the live log file from the moment the job starts and streams new bytes to the server as they are written. The stream is drained and closed cleanly when the job completes or is aborted.The log file path is discovered by inspecting the active Python logging handlers, so it works correctly in both the simulator and production without any workspace path arithmetic.
This widget runs inside the job subprocess (
CLIENT_JOBorSERVER_JOB) and must be placed in the job-level configuration (config_fed_client.jsonorconfig_fed_server.json). To stream multiple log files, add oneJobLogStreamerper file.- Parameters:
log_file_name – base name of the log file to stream. Defaults to
WorkspaceConstants.LOG_FILE_NAME("log.txt").liveness_interval – seconds between heartbeat messages when no new log bytes have been written (default 10.0). Must be less than the receiver’s
idle_timeout.poll_interval – seconds between polls when the log file has no new data (default 0.5).
Init the Widget.