Skip to content

Commit

Permalink
1.4.0: fix ci cd
Browse files Browse the repository at this point in the history
  • Loading branch information
louis030195 committed Dec 7, 2022
1 parent 1280938 commit 2c6a294
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
17 changes: 13 additions & 4 deletions run/collection/logic.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
import logging
from datetime import datetime
import time
from typing import Optional
from flask import request, jsonify
import sentry_sdk
Expand Down Expand Up @@ -154,7 +155,10 @@ async def create_starter():
400,
{},
)
with sentry_sdk.start_transaction(op="task", name="request_starter_for_service"):
start_time = time.time()
with sentry_sdk.start_transaction(
op="task", name="request_starter_for_service"
) as span:
# https://cloud.google.com/run/docs/tips/general#avoid_background_activities_if_cpu_is_allocated_only_during_request_processing
conversation_starters, error = await request_starter_for_service(
api_key_doc=api_key_doc,
Expand All @@ -166,9 +170,14 @@ async def create_starter():
profanity_threshold="open",
personas=personas,
)
logger.info(
f"Got conversation starter response: {conversation_starters} error: {error}"
)
end_time = time.time()
span.set_data("duration", end_time - start_time)
span.set_data("conversation_starters", conversation_starters)
span.set_data("error", error)
logger.info(
f"Got conversation starter response: {conversation_starters} error: {error}"
+ f" in {end_time - start_time} seconds"
)

if error:
return (
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
name="langame",
packages=find_packages(),
include_package_data=True,
version="1.3.8",
version="1.4.0",
description="",
install_requires=[
"firebase_admin",
Expand Down

0 comments on commit 2c6a294

Please sign in to comment.