penguin.search_utils module

class penguin.search_utils.ConfigSearch[source]

Bases: object

This class contains logic that would be shared across various configuration search algorithms.

analyze_failures(config, run_dir, exclusive=None)[source]

After we run a configuration, do our post-run analysis of failures. Run each PyPlugin that has a PenguinAnalysis implemented. Ask each to identify failures.

find_mitigations(failure, config)[source]
Parameters:

failure (Failure)

Return type:

List[Mitigation]

class penguin.search_utils.MABWeightedSet(alpha=5, beta=5)[source]

Bases: object

This class stores failures and potential solutions. Within each failure we have a set of potential solutions, each with its own weight, and we model each solution using Thompson Sampling with a Beta distribution.

We provide a probabilistic selection mechanism to select one of the failure’s solutions based on Thompson Sampling. After observing the result of the selected failure-solution pair, we update the Beta distributions for the solutions based on the observed result.

This class is thread-safe and can be used in a multi-threaded environment.

add_failure(failure_name, allow_none=True)[source]

Add a failure.

add_solution(failure_name, solution, exclusive=None)[source]

Add a potential solution to an existing failure.

probabilistic_mitigation_selection()[source]

Select independent failures to mitigate and pick one of their solutions.

queue_learning(failure_name, mitigation, config, exclusive)[source]

On a run we observed a failure that produced an exclusive mitigation - in other words, an analysis has requested we do a special (and expensive) run just so we can learn more about potential solutions to the failure. For now we’ll do it ASAP if it’s a new mitigation, otherwise we’ll ignore

report_result(selected_failures, final_score)[source]

Update the Beta distribution for the selected solution based on the observed result.

weighted_likelihood(final_score, avg_score)[source]

Calculate a weighted likelihood for updating based on score deviation.