Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cake-bot
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Oleksandr Barabash
cake-bot
Commits
13c07152
Commit
13c07152
authored
Oct 26, 2022
by
Oleksandr Barabash
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
additional loggs added
parent
d9947178
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
cosmos_client.py
utils/cosmos_client.py
+7
-2
No files found.
utils/cosmos_client.py
View file @
13c07152
""" Cosmos Client implementation """
import
asyncio
import
sys
import
uuid
from
concurrent
import
futures
from
typing
import
Any
,
Dict
,
Optional
,
Union
,
List
...
...
@@ -18,6 +19,7 @@ from entities.json.camel_case_mixin import timestamp_factory
from
entities.json.conversation_reference
import
ConversationReference
from
entities.json.initiation
import
Initiation
from
entities.json.notification
import
NotificationCosmos
from
utils.log
import
Log
class
CosmosClientException
(
Exception
):
...
...
@@ -84,10 +86,10 @@ class CosmosClient:
def
bl
()
->
ContainerProxy
:
""" Get Notifications container blocking """
try
:
return
db
.
get_container_client
(
container_id
)
except
exceptions
.
CosmosResourceNotFoundError
:
return
db
.
create_container
(
container_id
,
partition_key
,
**
kwargs
)
except
exceptions
.
CosmosResourceExistsError
:
return
db
.
get_container_client
(
container_id
)
return
await
self
.
execute_blocking
(
bl
)
...
...
@@ -311,6 +313,7 @@ class CosmosClient:
""" Save Conversation Regerence """
from
config
import
CosmosDBConfig
Log
.
i
(
__name__
,
"create_conversation_reference"
)
activity
=
turn_context
.
activity
reference
=
TurnContext
.
get_conversation_reference
(
activity
)
reference_json
=
ConversationReference
.
get_schema
()
.
dump
(
reference
)
...
...
@@ -327,6 +330,8 @@ class CosmosClient:
try
:
return
await
self
.
execute_blocking
(
bl
)
except
exceptions
.
CosmosHttpResponseError
as
e
:
Log
.
i
(
__name__
,
"create_conversation_reference::error:"
,
sys
.
exc_info
())
if
e
.
status_code
==
409
:
# Already exists
return
raise
SaveItemError
(
e
.
http_error_message
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment