-
Notifications
You must be signed in to change notification settings - Fork 428
Expand file tree
/
Copy path__init__.py
More file actions
80 lines (67 loc) · 2.76 KB
/
__init__.py
File metadata and controls
80 lines (67 loc) · 2.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
"""Components for managing tasks within the A2A server."""
import logging
from a2a.server.tasks.base_push_notification_sender import (
BasePushNotificationSender,
)
from a2a.server.tasks.inmemory_push_notification_config_store import (
InMemoryPushNotificationConfigStore,
)
from a2a.server.tasks.inmemory_task_store import InMemoryTaskStore
from a2a.server.tasks.push_notification_config_store import (
PushNotificationConfigStore,
)
from a2a.server.tasks.push_notification_sender import PushNotificationSender
from a2a.server.tasks.result_aggregator import ResultAggregator
from a2a.server.tasks.task_manager import TaskManager
from a2a.server.tasks.task_store import TaskStore
from a2a.server.tasks.task_updater import TaskUpdater
logger = logging.getLogger(__name__)
try:
from a2a.server.tasks.database_task_store import (
DatabaseTaskStore, # type: ignore
)
except ImportError as e:
_original_error = e
# If the database task store is not available, we can still use in-memory stores.
logger.debug(
'DatabaseTaskStore not loaded. This is expected if database dependencies are not installed. Error: %s',
e,
)
class DatabaseTaskStore: # type: ignore
"""Placeholder for DatabaseTaskStore when dependencies are not installed."""
def __init__(self, *args, **kwargs):
raise ImportError(
'To use DatabaseTaskStore, its dependencies must be installed. '
'You can install them with \'pip install "a2a-sdk[sql]"\''
) from _original_error
try:
from a2a.server.tasks.database_push_notification_config_store import (
DatabasePushNotificationConfigStore, # type: ignore
)
except ImportError as e:
_original_error = e
# If the database push notification config store is not available, we can still use in-memory stores.
logger.debug(
'DatabasePushNotificationConfigStore not loaded. This is expected if database dependencies are not installed. Error: %s',
e,
)
class DatabasePushNotificationConfigStore: # type: ignore
"""Placeholder for DatabasePushNotificationConfigStore when dependencies are not installed."""
def __init__(self, *args, **kwargs):
raise ImportError(
'To use DatabasePushNotificationConfigStore, its dependencies must be installed. '
'You can install them with \'pip install "a2a-sdk[sql]"\''
) from _original_error
__all__ = [
'BasePushNotificationSender',
'DatabasePushNotificationConfigStore',
'DatabaseTaskStore',
'InMemoryPushNotificationConfigStore',
'InMemoryTaskStore',
'PushNotificationConfigStore',
'PushNotificationSender',
'ResultAggregator',
'TaskManager',
'TaskStore',
'TaskUpdater',
]