Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions elementary/monitor/api/filters/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
from elementary.monitor.api.models.schema import (
ModelRunsSchema,
NormalizedModelSchema,
NormalizedSeedSchema,
NormalizedSnapshotSchema,
NormalizedSourceSchema,
)
from elementary.monitor.api.totals_schema import TotalsSchema
Expand All @@ -25,11 +27,15 @@ def get_filters(
models: Dict[str, NormalizedModelSchema],
sources: Dict[str, NormalizedSourceSchema],
models_runs: List[ModelRunsSchema],
seeds: Dict[str, NormalizedSeedSchema],
Comment thread
elazarlachkar marked this conversation as resolved.
snapshots: Dict[str, NormalizedSnapshotSchema],
) -> FiltersSchema:
test_results_filters = self._get_test_filters(
test_results_totals, models, sources
test_results_totals, models, sources, seeds, snapshots
)
test_runs_filters = self._get_test_filters(
test_runs_totals, models, sources, seeds, snapshots
)
test_runs_filters = self._get_test_filters(test_runs_totals, models, sources)
model_runs_filters = self._get_model_runs_filters(models_runs)
return FiltersSchema(
test_results=test_results_filters,
Expand All @@ -42,6 +48,8 @@ def _get_test_filters(
totals: Dict[str, TotalsSchema],
models: Dict[str, NormalizedModelSchema],
sources: Dict[str, NormalizedSourceSchema],
seeds: Dict[str, NormalizedSeedSchema],
snapshots: Dict[str, NormalizedSnapshotSchema],
) -> List[FilterSchema]:
failures_filter = FilterSchema(name="failures", display_name="Failures")
warnings_filter = FilterSchema(name="warnings", display_name="Warnings")
Expand All @@ -50,7 +58,12 @@ def _get_test_filters(
no_tests_filter = FilterSchema(name="no_test", display_name="No Tests")

totals_models_ids = totals.keys()
artifacts: List[ArtifactSchema] = [*models.values(), *sources.values()]
artifacts: List[ArtifactSchema] = [
*models.values(),
*sources.values(),
*seeds.values(),
*snapshots.values(),
]
for artifact in artifacts:
if artifact.unique_id and artifact.unique_id not in totals_models_ids:
no_tests_filter.add_model_unique_id(artifact.unique_id)
Expand Down
8 changes: 7 additions & 1 deletion elementary/monitor/api/report/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,13 @@ def get_report_data(
lineage_node_ids, exclude_elementary_models
)
filters = filters_api.get_filters(
test_results_totals, test_runs_totals, models, sources, models_runs.runs
test_results_totals,
test_runs_totals,
models,
sources,
models_runs.runs,
seeds,
snapshots,
)

serializable_groups = groups.dict()
Expand Down
Loading