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

Fix evaluation status which never was set to Queued. #1841

Merged
merged 4 commits into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ async def create_new_evaluation(
user=app.user,
testset=testset,
status=Result(
value=EvaluationStatusEnum.EVALUATION_STARTED, type="status", error=None
value=EvaluationStatusEnum.EVALUATION_INITIALIZED, type="status", error=None
),
variant=variant_id,
variant_revision=str(variant_revision.id),
Expand Down
26 changes: 20 additions & 6 deletions agenta-backend/agenta_backend/tasks/evaluations.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,18 @@ def evaluate(
loop = asyncio.get_event_loop()

try:
# 1. Fetch data from the database
loop.run_until_complete(DBEngine().init_db())

# 0. Update evaluation status to STARTED
loop.run_until_complete(
update_evaluation(
evaluation_id,
{"status": Result(type="status", value="EVALUATION_STARTED")},
mmabrouk marked this conversation as resolved.
Show resolved Hide resolved
)
)
self.update_state(state=states.STARTED)
mmabrouk marked this conversation as resolved.
Show resolved Hide resolved

# 1. Fetch data from the database
app = loop.run_until_complete(fetch_app_by_id(app_id))
app_variant_db = loop.run_until_complete(fetch_app_variant_by_id(variant_id))
assert (
Expand Down Expand Up @@ -249,12 +259,14 @@ def evaluate(
evaluators_results.append(result_object)

all_correct_answers = [
CorrectAnswer(
key=ground_truth_column_name,
value=data_point[ground_truth_column_name],
(
CorrectAnswer(
key=ground_truth_column_name,
value=data_point[ground_truth_column_name],
)
if ground_truth_column_name in data_point
else CorrectAnswer(key=ground_truth_column_name, value="")
)
if ground_truth_column_name in data_point
else CorrectAnswer(key=ground_truth_column_name, value="")
for ground_truth_column_name in ground_truth_column_names
]
# 4. We save the result of the eval scenario in the db
Expand Down Expand Up @@ -351,6 +363,8 @@ def evaluate(
)
)

self.update_state(state=states.SUCCESS)
mmabrouk marked this conversation as resolved.
Show resolved Hide resolved


async def aggregate_evaluator_results(
app: AppDB, evaluators_aggregated_data: dict
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ async def create_evaluation_with_evaluator(evaluator_config_name):
assert response_data["app_id"] == payload["app_id"]
assert (
response_data["status"]["value"]
== EvaluationStatusEnum.EVALUATION_STARTED.value
== EvaluationStatusEnum.EVALUATION_INITIALIZED.value
)
assert response_data is not None

Expand Down
Loading