Feature/custom solver support - #68
Draft
adefabian wants to merge 3 commits into
Draft
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #68 +/- ##
==========================================
+ Coverage 88.72% 88.93% +0.20%
==========================================
Files 59 61 +2
Lines 4826 4906 +80
Branches 552 556 +4
==========================================
+ Hits 4282 4363 +81
+ Misses 445 444 -1
Partials 99 99
🚀 New features to boost your workflow:
|
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
Customers can now ship their own
QuerySolver(say, one that reshapes their rawtables into the Impulse silver schema) without touching Impulse core.
Solvers register themselves by name, the report config picks one by that name through the
existing
query_engine.solverfield, and each solver can bring its ownSolverConfigsubclass whose extra fields get checked at parse time.Config picks a solver by registered name, not by class path. So a config can't
make Impulse import and run some arbitrary class. What solvers exist depends
entirely on what the driver imports.
DefaultSolvermoves onto this mechanism with no behavior change. It registersunder
"DefaultSolver"(plus the old"DeltaSolver"/"KeyValueStoreSolver"aliases), so existing configs keep working.
Changes
solvers/registry.py):@register_solver(name, config_cls, *, aliases, overwrite)plusresolve_registration/is_registered/registered_names. Maps a name to(solver_cls, config_cls), rejects conflicting duplicates, and lists the known names when a lookup misses.QuerySolver.from_config+solvers/solver_context.py): a frozenSolverBuildContext(spark,solver_config,is_raw_data,drop_implausible_data,raw_encoder) is the one place construction inputs live. Basefrom_configpasses justsolver_config;DefaultSolveroverrides it to also wire spark and the raw-data flags. The report factory builds any solver the same way, whatever its constructor looks like.QuerySolver:load_container_tags,load_container_metrics,load_channel_tags,load_channel_metrics,load_channel_mapping,load_unit_conversion,load_channels. Defaults read the single configured table (same as before); a custom solver overrides them to combine or reshape raw sources.DefaultSolver's reads now go through these seams.config_parser.py):query_engine.solveris a plainstrnow (any registered name).Solversbecomes aStrEnumso old== Solvers.DEFAULT_SOLVERcomparisons still hold. Amode="before"validator re-validatessolver_configthrough the selected solver'sconfig_cls, so a custom solver's fields are enforced at parse time and an unregistered name fails early as aValidationError.core/report.py):create_solverresolves the name through the registry and callsfrom_config(ctx)instead of a hardcodedmatch. Incremental change detection reads containers viasolver.load_container_metrics(...), so a reshaping solver feeds the same container set into upsert detection.docs/impulse/docs/data_model/ingestion.md): a "Registering a custom solver" section covering subclassingDefaultSolver, declaring aSolverConfigsubclass, selecting it by name, and importing the package so registration runs.Test Plan
Checklist