Skip to content

Allow for returning query traces on cached query executions.#959

Merged
mdwelsh merged 11 commits into
mainfrom
matt/luna-trace-caching
Oct 25, 2024
Merged

Allow for returning query traces on cached query executions.#959
mdwelsh merged 11 commits into
mainfrom
matt/luna-trace-caching

Conversation

@mdwelsh
Copy link
Copy Markdown
Contributor

@mdwelsh mdwelsh commented Oct 21, 2024

This PR replaces #949 with a better implementation that allows the results of cached query executions to return traces. This is done by removing the concept of a separate 'trace_dir' and returning the location of the cache results for each node in the query plan. This way we can have our cache and traces too :-)

The PR also makes a few other small changes:

  • Returning a query ID and a result from the query client was becoming unwieldy, so I added a new SycamoreQueryResult type which includes the query ID, query plan, query result, and the location of the query traces.
  • I replaced a couple of places where we were manually reading in trace files with the use of .materialize() so we can use the same logic for reading the traces back everywhere.
  • I fixed up the Sycamore query integration tests, relaxing the constraints on the exact answer, and fixing a bug whereby the code generated for .rerank was broken. This test now passes!

Comment thread lib/sycamore/sycamore/query/result.py
Comment thread lib/sycamore/sycamore/query/result.py Outdated
assert isinstance(result, str)
assert len(result) > 0
result = client.run_plan(plan, codegen_mode=codegen_mode)
assert isinstance(result.result, str)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems like this is failing

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was passing for me but the test is still flaky

Comment thread lib/sycamore/sycamore/query/execution/sycamore_executor.py Outdated
@mdwelsh mdwelsh requested a review from baitsguy October 23, 2024 22:30
Comment thread apps/query-ui/queryui/util.py
Comment thread apps/query-ui/queryui/util.py
Comment thread lib/sycamore/sycamore/query/execution/sycamore_executor.py
Comment thread lib/sycamore/sycamore/query/result.py
@mdwelsh mdwelsh merged commit bff9cd2 into main Oct 25, 2024
@HenryL27 HenryL27 deleted the matt/luna-trace-caching branch August 30, 2025 00:03
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

Successfully merging this pull request may close these issues.

2 participants