-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enrich logging through context vars (#452)
The implementation makes use of python `contextvars.ContextVar` to store experiment-specific state. The state is used to dynamically modify experiment-level logging. For example, this driver: ```py exp1 = smartsim.Experiment('exp-1') rs1 = exp1.create_runsettings(...) model1 = exp1.create_model(..., rs1) exp2 = smartsim.Experiment('other-exp') rs2 = exp2.create_runsettings(...) model2 = exp2.create_model(..., rs2) exp1.start(model1) exp1.start(model2) ``` Results in each experiment dynamically registering `logging.FileHandler` instances that write logs to separate files: - `/exp-1/.telemetry/smartsim/smartsim.out` - `/other-exp/.telemetry/smartsim/smartsim.out` ### Key changes: 1. Decorated experiment API w/contextualizer to enrich log context 2. Create/Use `ContextThread` to ensure threads include current context information 3. Create/Use `ContextAwareLogger` to dynamically add file handlers for experiment logs 4. Updated manifest serialization to include paths to experiment-specific log files 5. Added `LowPassFilter` to enable splitting experiment logs across `xxx.out` and `xxx.err` ### Additional minor changes: 1. Moved `serialize.TELMON_SUBDIR` constant to `Config.telemetry_subdir` to make it more universally available --------- Co-authored-by: Matt Drozt <[email protected]> Co-authored-by: Matt Drozt <[email protected]> [ committed by @ankona ] [ reviewed by @al-rigazzi @MattToast ]
- Loading branch information
Showing
16 changed files
with
544 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.