Repository navigation
Conversation
Running multiple OpenEvolve calls in parallel makes it hard to tell which log lines belong to which run (issue algorithmicsuperintelligence#290). Add an optional prefix that is applied to every downstream module logger name: - Config.logger_prefix (e.g. "run1" logs as "run1.openevolve.*") - --logger-prefix CLI flag, applied before controller construction - New LoggerPrefixFilter (openevolve/utils/logging_utils.py): a handler-level logging.Filter that rewrites record.name in _setup_logging; idempotent so a record shared by several handlers is only prefixed once. The console formatter gains %(name)s only when a prefix is set, so the default output format is unchanged. Fixes algorithmicsuperintelligence#290
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add an optional logger prefix so log output from concurrent OpenEvolve runs can be told apart.
Config.logger_prefix: Optional[str]— set it directly when using the library:OpenEvolve(..., config=Config(logger_prefix="run1"))oropenevolve.run_evolution(..., config=Config(logger_prefix="run1")), addressing the "optional prefix" request in Feature Request: Logger prefix #290 (delivered viaConfig+ CLI rather than arun()kwarg, as planned on the issue).--logger-prefixCLI flag, applied to the config before the controller is constructed.LoggerPrefixFilter(openevolve/utils/logging_utils.py): a handler-levellogging.Filterinstalled by_setup_logging()that rewritesrecord.name(e.g.openevolve.controller→run1.openevolve.controller). Since all module loggers are created at import time vialogging.getLogger(__name__), rewritingrecord.nameat the handler level is the one clean point that covers all of them without touching each module.LogRecordobject flows through every handler on the logger, so the prefix is applied exactly once.%(name)s(the file formatter already had it). Without a prefix the output format is byte-for-byte unchanged.Example:
Motivation
Fixes #290. As @theahura reported, running multiple
openevolve.run()calls in parallel makes it extremely hard to tell which logs belong to which run. @codelion endorsed the idea on 2025-10-13: "This is a good idea we can add a logger prefix." This PR lands exactly that, with the smallest footprint possible.Scope notes
_setup_logging); that's the domain of Multiple Openevolve run calls in parallel result in clobbered loggers #295.contextvarsfor Multiple Openevolve run calls in parallel result in clobbered loggers #295; the two changes are complementary. If Isolate per-run logging from the process root logger #499 merges first, this PR will need a small rebase of_setup_logging(the filter itself is independent).Testing
New fully-offline unittest suite
tests/test_logger_prefix.py(7 tests;LLMEnsemble/Evaluatorpatched, no LLM calls):record.name, idempotent under repeated application, empty prefix is a no-op, never swallows records.OpenEvolve(config=Config(logger_prefix="run1"))(constructor runs_setup_logging) writesrun1.openevolve.controllerto both the log file and the console stream; with no prefix, output is unchanged (plain names, norun1.).Red → green:
ModuleNotFoundError: No module named 'openevolve.utils.logging_utils'(1 test, FAILED).Ran 7 tests ... OK.Full regression (CONTRIBUTING command):
Formatting:
black --line-length 100andisort --profile black --line-length 100applied to all changed files.