Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI 500 when opening a report or tests if one of the metrics or tests ends with an error #1033

Open
c0t0ber opened this issue Mar 18, 2024 · 0 comments

Comments

@c0t0ber
Copy link
Contributor

c0t0ber commented Mar 18, 2024

import logging

import numpy as np
import pandas as pd

from evidently.metrics import ColumnDriftMetric
from evidently.report import Report
from evidently.ui.base import Project
from evidently.ui.workspace import Workspace

logging.basicConfig(level=logging.DEBUG)

def create_evidently_project(workspace_name: str, project_name: str) -> Project:
    ws = Workspace.create(workspace_name)
    if projs := ws.search_project(project_name):
        proj = projs[0]
    else:
        proj = ws.create_project(project_name)

    return proj


proj = create_evidently_project("test_error_bug", "test_error_bug")

data = pd.DataFrame(
    {"vals": [np.nan] * 100}
)
ref_data = pd.DataFrame(
    {"vals": [1] * 1000},
)

ref_data.to_parquet("ref_data.parquet", index=False)
used_features = ["vals"]
rep = Report(
    metrics=[
        *[ColumnDriftMetric(column_name=column) for column in used_features],
    ],
)
rep.run(reference_data=ref_data, current_data=data)

try:
    rep._inner_suite.raise_for_error()
except Exception as e:
    print(e)

rep.save(f"test_error_bug/{str(proj.id)}/snapshots/{str(rep.id)}.json")

If u open generated report you get 500 and

  File "evidently\src\evidently\report\report.py", line 212, in _build_dashboard_info
    html_info = renderer.render_html(test)
  File "evidently\src\evidently\metrics\data_drift\column_drift_metric.py", line 322, in render_html
    if result.drift_detected:
AttributeError: 'MetricResult' object has no attribute 'drift_detected'
@c0t0ber c0t0ber changed the title UI crashes when opening a report or tests if one of the metrics or tests ends with an error UI 500 when opening a report or tests if one of the metrics or tests ends with an error Mar 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant