Skip to content

Commit

Permalink
Refactor: improve retrieve_variant_logs endpoint and remove condition…
Browse files Browse the repository at this point in the history
… dupicate for view error logs on playground
  • Loading branch information
aybruhm committed May 7, 2024
1 parent d4f9325 commit 2cec7a6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 15 deletions.
6 changes: 1 addition & 5 deletions agenta-backend/agenta_backend/routers/variants_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,11 +320,7 @@ async def retrieve_variant_logs(variant_id: str, request: Request):
try:
app_variant = await db_manager.fetch_app_variant_by_id(variant_id)
deployment = await db_manager.get_deployment_by_appid(str(app_variant.app.id))
is_coroutine_function = inspect.iscoroutinefunction(logs_manager.retrieve_logs)
if is_coroutine_function:
logs_result = await logs_manager.retrieve_logs(deployment.container_id)
else:
logs_result = logs_manager.retrieve_logs(deployment.container_id)
logs_result = await logs_manager.retrieve_logs(deployment.container_id)
return logs_result
except Exception as exc:
logger.exception(f"An error occurred: {str(exc)}")
Expand Down
13 changes: 3 additions & 10 deletions agenta-web/src/components/Playground/ViewNavigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -186,16 +186,9 @@ const ViewNavigation: React.FC<Props> = ({
)) || <span>{error.message}</span>}
</p>
<ul>
{isDemo() && (
<div>
<pre className={classes.errorLogs}>{variantErrorLogs}</pre>
</div>
)}
{!isDemo() && (
<div>
<pre className={classes.errorLogs}>{variantErrorLogs}</pre>
</div>
)}
<div>
<pre className={classes.errorLogs}>{variantErrorLogs}</pre>
</div>
</ul>
<p>
Verify API accessibility at{" "}
Expand Down

0 comments on commit 2cec7a6

Please sign in to comment.