Skip to content

Commit

Permalink
Merge pull request #705 from parea-ai/PAI-968-experiment-with-llm-cal…
Browse files Browse the repository at this point in the history
…l-large-scale

fix: don't log parent in wrapper
  • Loading branch information
joschkabraun committed Apr 5, 2024
2 parents ac4cc55 + 549c521 commit 3e65430
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 8 deletions.
7 changes: 0 additions & 7 deletions parea/wrapper/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ def wrapper(*args, **kwargs):
def _cleanup_trace_core(self, trace_id: str, start_time: datetime, error: str, cache_hit, args, kwargs, context_token: contextvars.Token):
trace_data.get()[trace_id].cache_hit = cache_hit

parent_id = trace_context.get()[-2] if len(trace_context.get()) > 1 else None
if error:
trace_data.get()[trace_id].error = error
trace_data.get()[trace_id].status = "error"
Expand All @@ -182,17 +181,11 @@ def final_log():
end_time = timezone_aware_now()
trace_data.get()[trace_id].end_timestamp = end_time.isoformat()
trace_data.get()[trace_id].latency = (end_time - start_time).total_seconds()
if parent_id:
trace_data.get()[parent_id].end_timestamp = end_time.isoformat()
start_time_parent = datetime.fromisoformat(trace_data.get()[parent_id].start_timestamp)
trace_data.get()[parent_id].latency = (end_time - start_time_parent).total_seconds()

if not error and self.cache:
self.cache.set(self.convert_kwargs_to_cache_request(args, kwargs), trace_data.get()[trace_id])

self.log(trace_id)
if parent_id:
self.log(parent_id)
try:
trace_context.reset(context_token)
except IndexError:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build-backend = "poetry.core.masonry.api"
[tool.poetry]
name = "parea-ai"
packages = [{ include = "parea" }]
version = "0.2.123"
version = "0.2.124"
description = "Parea python sdk"
readme = "README.md"
authors = ["joel-parea-ai <[email protected]>"]
Expand Down

0 comments on commit 3e65430

Please sign in to comment.