trustgraph-base 2.2.21__tar.gz → 2.2.22__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/PKG-INFO +1 -1
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/base/async_processor.py +0 -1
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/base/consumer.py +47 -23
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/base/subscriber.py +30 -16
- trustgraph_base-2.2.22/trustgraph/base_version.py +1 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph_base.egg-info/PKG-INFO +1 -1
- trustgraph_base-2.2.21/trustgraph/base_version.py +0 -1
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/README.md +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/pyproject.toml +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/setup.cfg +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/api/__init__.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/api/api.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/api/async_bulk_client.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/api/async_flow.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/api/async_metrics.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/api/async_socket_client.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/api/bulk_client.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/api/collection.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/api/config.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/api/exceptions.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/api/explainability.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/api/flow.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/api/knowledge.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/api/library.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/api/metrics.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/api/socket_client.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/api/types.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/base/__init__.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/base/agent_client.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/base/agent_service.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/base/backend.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/base/cassandra_config.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/base/chunking_service.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/base/collection_config_handler.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/base/consumer_spec.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/base/document_embeddings_client.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/base/document_embeddings_query_service.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/base/document_embeddings_store_service.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/base/dynamic_tool_service.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/base/embeddings_client.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/base/embeddings_service.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/base/flow.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/base/flow_processor.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/base/graph_embeddings_client.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/base/graph_embeddings_query_service.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/base/graph_embeddings_store_service.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/base/graph_rag_client.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/base/librarian_client.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/base/llm_service.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/base/logging.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/base/metrics.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/base/parameter_spec.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/base/producer.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/base/producer_spec.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/base/prompt_client.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/base/publisher.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/base/pubsub.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/base/pulsar_backend.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/base/rabbitmq_backend.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/base/request_response_spec.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/base/row_embeddings_query_client.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/base/serialization.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/base/spec.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/base/structured_query_client.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/base/subscriber_spec.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/base/text_completion_client.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/base/tool_client.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/base/tool_service.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/base/tool_service_client.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/base/triples_client.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/base/triples_query_service.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/base/triples_store_service.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/clients/__init__.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/clients/agent_client.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/clients/base.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/clients/config_client.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/clients/document_embeddings_client.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/clients/document_rag_client.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/clients/embeddings_client.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/clients/graph_embeddings_client.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/clients/graph_rag_client.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/clients/llm_client.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/clients/prompt_client.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/clients/row_embeddings_client.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/clients/triples_query_client.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/exceptions.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/knowledge/__init__.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/knowledge/defs.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/knowledge/document.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/knowledge/identifier.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/knowledge/organization.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/knowledge/publication.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/log_level.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/messaging/__init__.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/messaging/registry.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/messaging/translators/__init__.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/messaging/translators/agent.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/messaging/translators/base.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/messaging/translators/collection.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/messaging/translators/config.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/messaging/translators/diagnosis.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/messaging/translators/document_loading.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/messaging/translators/embeddings.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/messaging/translators/embeddings_query.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/messaging/translators/flow.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/messaging/translators/knowledge.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/messaging/translators/library.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/messaging/translators/metadata.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/messaging/translators/nlp_query.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/messaging/translators/primitives.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/messaging/translators/prompt.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/messaging/translators/retrieval.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/messaging/translators/rows_query.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/messaging/translators/sparql_query.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/messaging/translators/structured_query.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/messaging/translators/text_completion.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/messaging/translators/tool.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/messaging/translators/triples.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/objects/__init__.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/objects/field.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/objects/object.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/provenance/__init__.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/provenance/agent.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/provenance/namespaces.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/provenance/triples.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/provenance/uris.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/provenance/vocabulary.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/rdf.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/schema/__init__.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/schema/core/__init__.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/schema/core/metadata.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/schema/core/primitives.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/schema/core/topic.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/schema/knowledge/__init__.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/schema/knowledge/document.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/schema/knowledge/embeddings.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/schema/knowledge/graph.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/schema/knowledge/knowledge.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/schema/knowledge/nlp.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/schema/knowledge/object.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/schema/knowledge/rows.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/schema/knowledge/structured.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/schema/services/__init__.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/schema/services/agent.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/schema/services/collection.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/schema/services/config.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/schema/services/diagnosis.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/schema/services/flow.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/schema/services/library.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/schema/services/llm.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/schema/services/lookup.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/schema/services/nlp_query.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/schema/services/prompt.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/schema/services/query.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/schema/services/retrieval.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/schema/services/rows_query.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/schema/services/sparql_query.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/schema/services/storage.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/schema/services/structured_query.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/schema/services/tool_service.py +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph_base.egg-info/SOURCES.txt +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph_base.egg-info/dependency_links.txt +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph_base.egg-info/requires.txt +0 -0
- {trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph_base.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: trustgraph-base
|
|
3
|
-
Version: 2.2.
|
|
3
|
+
Version: 2.2.22
|
|
4
4
|
Summary: TrustGraph provides a means to run a pipeline of flexible AI processing components in a flexible means to achieve a processing pipeline.
|
|
5
5
|
Author-email: "trustgraph.ai" <security@trustgraph.ai>
|
|
6
6
|
Project-URL: Homepage, https://github.com/trustgraph-ai/trustgraph
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
import asyncio
|
|
13
13
|
import time
|
|
14
14
|
import logging
|
|
15
|
+
from concurrent.futures import ThreadPoolExecutor
|
|
15
16
|
|
|
16
17
|
from .. exceptions import TooManyRequests
|
|
17
18
|
|
|
@@ -110,29 +111,37 @@ class Consumer:
|
|
|
110
111
|
logger.info(f"Starting {self.concurrency} receiver threads")
|
|
111
112
|
|
|
112
113
|
# Create one backend consumer per concurrent task.
|
|
113
|
-
# Each gets its own connection
|
|
114
|
-
# like RabbitMQ where connections
|
|
114
|
+
# Each gets its own connection and dedicated thread —
|
|
115
|
+
# required for backends like RabbitMQ where connections
|
|
116
|
+
# are not thread-safe (pika BlockingConnection must be
|
|
117
|
+
# used from a single thread).
|
|
115
118
|
consumers = []
|
|
119
|
+
executors = []
|
|
116
120
|
for i in range(self.concurrency):
|
|
117
121
|
try:
|
|
118
122
|
logger.info(f"Subscribing to topic: {self.topic} (worker {i})")
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
123
|
+
executor = ThreadPoolExecutor(max_workers=1)
|
|
124
|
+
loop = asyncio.get_event_loop()
|
|
125
|
+
c = await loop.run_in_executor(
|
|
126
|
+
executor,
|
|
127
|
+
lambda: self.backend.create_consumer(
|
|
128
|
+
topic = self.topic,
|
|
129
|
+
subscription = self.subscriber,
|
|
130
|
+
schema = self.schema,
|
|
131
|
+
initial_position = initial_pos,
|
|
132
|
+
consumer_type = self.consumer_type,
|
|
133
|
+
),
|
|
126
134
|
)
|
|
127
135
|
consumers.append(c)
|
|
136
|
+
executors.append(executor)
|
|
128
137
|
logger.info(f"Successfully subscribed to topic: {self.topic} (worker {i})")
|
|
129
138
|
except Exception as e:
|
|
130
139
|
logger.error(f"Consumer subscription exception (worker {i}): {e}", exc_info=True)
|
|
131
140
|
raise
|
|
132
141
|
|
|
133
142
|
async with asyncio.TaskGroup() as tg:
|
|
134
|
-
for c in consumers:
|
|
135
|
-
tg.create_task(self.consume_from_queue(c))
|
|
143
|
+
for c, ex in zip(consumers, executors):
|
|
144
|
+
tg.create_task(self.consume_from_queue(c, ex))
|
|
136
145
|
|
|
137
146
|
if self.metrics:
|
|
138
147
|
self.metrics.state("stopped")
|
|
@@ -146,7 +155,10 @@ class Consumer:
|
|
|
146
155
|
c.close()
|
|
147
156
|
except Exception:
|
|
148
157
|
pass
|
|
158
|
+
for ex in executors:
|
|
159
|
+
ex.shutdown(wait=False)
|
|
149
160
|
consumers = []
|
|
161
|
+
executors = []
|
|
150
162
|
await asyncio.sleep(self.reconnect_time)
|
|
151
163
|
continue
|
|
152
164
|
|
|
@@ -157,15 +169,18 @@ class Consumer:
|
|
|
157
169
|
c.close()
|
|
158
170
|
except Exception:
|
|
159
171
|
pass
|
|
172
|
+
for ex in executors:
|
|
173
|
+
ex.shutdown(wait=False)
|
|
160
174
|
|
|
161
|
-
async def consume_from_queue(self, consumer):
|
|
175
|
+
async def consume_from_queue(self, consumer, executor=None):
|
|
162
176
|
|
|
177
|
+
loop = asyncio.get_event_loop()
|
|
163
178
|
while self.running:
|
|
164
179
|
|
|
165
180
|
try:
|
|
166
|
-
msg = await
|
|
167
|
-
|
|
168
|
-
timeout_millis=100
|
|
181
|
+
msg = await loop.run_in_executor(
|
|
182
|
+
executor,
|
|
183
|
+
lambda: consumer.receive(timeout_millis=100),
|
|
169
184
|
)
|
|
170
185
|
except Exception as e:
|
|
171
186
|
# Handle timeout from any backend
|
|
@@ -173,10 +188,11 @@ class Consumer:
|
|
|
173
188
|
continue
|
|
174
189
|
raise e
|
|
175
190
|
|
|
176
|
-
await self.handle_one_from_queue(msg, consumer)
|
|
191
|
+
await self.handle_one_from_queue(msg, consumer, executor)
|
|
177
192
|
|
|
178
|
-
async def handle_one_from_queue(self, msg, consumer):
|
|
193
|
+
async def handle_one_from_queue(self, msg, consumer, executor=None):
|
|
179
194
|
|
|
195
|
+
loop = asyncio.get_event_loop()
|
|
180
196
|
expiry = time.time() + self.rate_limit_timeout
|
|
181
197
|
|
|
182
198
|
# This loop is for retry on rate-limit / resource limits
|
|
@@ -187,8 +203,11 @@ class Consumer:
|
|
|
187
203
|
logger.warning("Gave up waiting for rate-limit retry")
|
|
188
204
|
|
|
189
205
|
# Message failed to be processed, this causes it to
|
|
190
|
-
# be retried
|
|
191
|
-
|
|
206
|
+
# be retried. Ack on the consumer's dedicated thread
|
|
207
|
+
# (pika is not thread-safe).
|
|
208
|
+
await loop.run_in_executor(
|
|
209
|
+
executor, lambda: consumer.negative_acknowledge(msg)
|
|
210
|
+
)
|
|
192
211
|
|
|
193
212
|
if self.metrics:
|
|
194
213
|
self.metrics.process("error")
|
|
@@ -210,8 +229,11 @@ class Consumer:
|
|
|
210
229
|
|
|
211
230
|
logger.debug("Message processed successfully")
|
|
212
231
|
|
|
213
|
-
# Acknowledge
|
|
214
|
-
|
|
232
|
+
# Acknowledge on the consumer's dedicated thread
|
|
233
|
+
# (pika is not thread-safe)
|
|
234
|
+
await loop.run_in_executor(
|
|
235
|
+
executor, lambda: consumer.acknowledge(msg)
|
|
236
|
+
)
|
|
215
237
|
|
|
216
238
|
if self.metrics:
|
|
217
239
|
self.metrics.process("success")
|
|
@@ -237,8 +259,10 @@ class Consumer:
|
|
|
237
259
|
logger.error(f"Message processing exception: {e}", exc_info=True)
|
|
238
260
|
|
|
239
261
|
# Message failed to be processed, this causes it to
|
|
240
|
-
# be retried
|
|
241
|
-
|
|
262
|
+
# be retried. Ack on the consumer's dedicated thread.
|
|
263
|
+
await loop.run_in_executor(
|
|
264
|
+
executor, lambda: consumer.negative_acknowledge(msg)
|
|
265
|
+
)
|
|
242
266
|
|
|
243
267
|
if self.metrics:
|
|
244
268
|
self.metrics.process("error")
|
|
@@ -7,6 +7,7 @@ import asyncio
|
|
|
7
7
|
import time
|
|
8
8
|
import logging
|
|
9
9
|
import uuid
|
|
10
|
+
from concurrent.futures import ThreadPoolExecutor
|
|
10
11
|
|
|
11
12
|
# Module logger
|
|
12
13
|
logger = logging.getLogger(__name__)
|
|
@@ -38,6 +39,7 @@ class Subscriber:
|
|
|
38
39
|
self.pending_acks = {} # Track messages awaiting delivery
|
|
39
40
|
|
|
40
41
|
self.consumer = None
|
|
42
|
+
self.executor = None
|
|
41
43
|
|
|
42
44
|
def __del__(self):
|
|
43
45
|
|
|
@@ -45,15 +47,6 @@ class Subscriber:
|
|
|
45
47
|
|
|
46
48
|
async def start(self):
|
|
47
49
|
|
|
48
|
-
# Create consumer via backend
|
|
49
|
-
self.consumer = await asyncio.to_thread(
|
|
50
|
-
self.backend.create_consumer,
|
|
51
|
-
topic=self.topic,
|
|
52
|
-
subscription=self.subscription,
|
|
53
|
-
schema=self.schema,
|
|
54
|
-
consumer_type='exclusive',
|
|
55
|
-
)
|
|
56
|
-
|
|
57
50
|
self.task = asyncio.create_task(self.run())
|
|
58
51
|
|
|
59
52
|
async def stop(self):
|
|
@@ -80,6 +73,21 @@ class Subscriber:
|
|
|
80
73
|
|
|
81
74
|
try:
|
|
82
75
|
|
|
76
|
+
# Create consumer and dedicated thread if needed
|
|
77
|
+
# (first run or after failure)
|
|
78
|
+
if self.consumer is None:
|
|
79
|
+
self.executor = ThreadPoolExecutor(max_workers=1)
|
|
80
|
+
loop = asyncio.get_event_loop()
|
|
81
|
+
self.consumer = await loop.run_in_executor(
|
|
82
|
+
self.executor,
|
|
83
|
+
lambda: self.backend.create_consumer(
|
|
84
|
+
topic=self.topic,
|
|
85
|
+
subscription=self.subscription,
|
|
86
|
+
schema=self.schema,
|
|
87
|
+
consumer_type='exclusive',
|
|
88
|
+
),
|
|
89
|
+
)
|
|
90
|
+
|
|
83
91
|
if self.metrics:
|
|
84
92
|
self.metrics.state("running")
|
|
85
93
|
|
|
@@ -128,9 +136,12 @@ class Subscriber:
|
|
|
128
136
|
# Process messages only if not draining
|
|
129
137
|
if not self.draining:
|
|
130
138
|
try:
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
139
|
+
loop = asyncio.get_event_loop()
|
|
140
|
+
msg = await loop.run_in_executor(
|
|
141
|
+
self.executor,
|
|
142
|
+
lambda: self.consumer.receive(
|
|
143
|
+
timeout_millis=250
|
|
144
|
+
),
|
|
134
145
|
)
|
|
135
146
|
except Exception as e:
|
|
136
147
|
# Handle timeout from any backend
|
|
@@ -172,15 +183,18 @@ class Subscriber:
|
|
|
172
183
|
except Exception:
|
|
173
184
|
pass # Already closed or error
|
|
174
185
|
self.consumer = None
|
|
175
|
-
|
|
176
|
-
|
|
186
|
+
|
|
187
|
+
if self.executor:
|
|
188
|
+
self.executor.shutdown(wait=False)
|
|
189
|
+
self.executor = None
|
|
190
|
+
|
|
177
191
|
if self.metrics:
|
|
178
192
|
self.metrics.state("stopped")
|
|
179
193
|
|
|
180
194
|
if not self.running and not self.draining:
|
|
181
195
|
return
|
|
182
|
-
|
|
183
|
-
#
|
|
196
|
+
|
|
197
|
+
# Sleep before retry
|
|
184
198
|
await asyncio.sleep(1)
|
|
185
199
|
|
|
186
200
|
async def subscribe(self, id):
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "2.2.22"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: trustgraph-base
|
|
3
|
-
Version: 2.2.
|
|
3
|
+
Version: 2.2.22
|
|
4
4
|
Summary: TrustGraph provides a means to run a pipeline of flexible AI processing components in a flexible means to achieve a processing pipeline.
|
|
5
5
|
Author-email: "trustgraph.ai" <security@trustgraph.ai>
|
|
6
6
|
Project-URL: Homepage, https://github.com/trustgraph-ai/trustgraph
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "2.2.21"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/base/collection_config_handler.py
RENAMED
|
File without changes
|
|
File without changes
|
{trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/base/document_embeddings_client.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/base/graph_embeddings_client.py
RENAMED
|
File without changes
|
{trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/base/graph_embeddings_query_service.py
RENAMED
|
File without changes
|
{trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/base/graph_embeddings_store_service.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/base/row_embeddings_query_client.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/base/structured_query_client.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/clients/document_embeddings_client.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/clients/graph_embeddings_client.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/clients/row_embeddings_client.py
RENAMED
|
File without changes
|
{trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/clients/triples_query_client.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/messaging/translators/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/messaging/translators/collection.py
RENAMED
|
File without changes
|
{trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/messaging/translators/config.py
RENAMED
|
File without changes
|
{trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/messaging/translators/diagnosis.py
RENAMED
|
File without changes
|
|
File without changes
|
{trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/messaging/translators/embeddings.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/messaging/translators/knowledge.py
RENAMED
|
File without changes
|
{trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/messaging/translators/library.py
RENAMED
|
File without changes
|
{trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/messaging/translators/metadata.py
RENAMED
|
File without changes
|
{trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/messaging/translators/nlp_query.py
RENAMED
|
File without changes
|
{trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/messaging/translators/primitives.py
RENAMED
|
File without changes
|
{trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/messaging/translators/prompt.py
RENAMED
|
File without changes
|
{trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/messaging/translators/retrieval.py
RENAMED
|
File without changes
|
{trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/messaging/translators/rows_query.py
RENAMED
|
File without changes
|
{trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/messaging/translators/sparql_query.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/messaging/translators/triples.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/schema/services/sparql_query.py
RENAMED
|
File without changes
|
|
File without changes
|
{trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/schema/services/structured_query.py
RENAMED
|
File without changes
|
{trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph/schema/services/tool_service.py
RENAMED
|
File without changes
|
|
File without changes
|
{trustgraph_base-2.2.21 → trustgraph_base-2.2.22}/trustgraph_base.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|