Skip to content

Commit

Permalink
Use asyncio.sleep before querying database after client interactions
Browse files Browse the repository at this point in the history
  • Loading branch information
anticorrelator committed Sep 11, 2024
1 parent 8eeee7d commit fced295
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tests/datasets/test_experiments.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import json
import time
import asyncio
from datetime import datetime, timezone
from typing import Any, Dict
from unittest.mock import patch
Expand Down Expand Up @@ -94,6 +94,7 @@ def experiment_task(_) -> Dict[str, str]:
evaluators={f"{i:02}": e for i, e in enumerate(evaluators)},
print_summary=False,
)
await asyncio.sleep(3)
experiment_id = from_global_id_with_expected_type(
GlobalID.from_id(experiment.id), "Experiment"
)
Expand Down Expand Up @@ -274,7 +275,7 @@ async def test_run_evaluation(
)
with patch("phoenix.experiments.functions._phoenix_clients", return_value=httpx_clients):
evaluate_experiment(experiment, evaluators=[lambda _: _])
time.sleep(1) # Wait for the evaluations to be inserted
await asyncio.sleep(1) # Wait for the evaluations to be inserted
async with db() as session:
evaluations = list(await session.scalars(select(models.ExperimentRunAnnotation)))
assert len(evaluations) == 1
Expand Down

0 comments on commit fced295

Please sign in to comment.