trustgraph-base 2.2.19__tar.gz → 2.2.20__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.19 → trustgraph_base-2.2.20}/PKG-INFO +1 -1
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/base/async_processor.py +149 -23
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/base/flow_processor.py +3 -1
- trustgraph_base-2.2.20/trustgraph/base_version.py +1 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/schema/services/config.py +2 -2
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph_base.egg-info/PKG-INFO +1 -1
- trustgraph_base-2.2.19/trustgraph/base_version.py +0 -1
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/README.md +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/pyproject.toml +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/setup.cfg +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/api/__init__.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/api/api.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/api/async_bulk_client.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/api/async_flow.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/api/async_metrics.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/api/async_socket_client.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/api/bulk_client.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/api/collection.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/api/config.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/api/exceptions.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/api/explainability.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/api/flow.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/api/knowledge.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/api/library.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/api/metrics.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/api/socket_client.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/api/types.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/base/__init__.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/base/agent_client.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/base/agent_service.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/base/backend.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/base/cassandra_config.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/base/chunking_service.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/base/collection_config_handler.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/base/consumer.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/base/consumer_spec.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/base/document_embeddings_client.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/base/document_embeddings_query_service.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/base/document_embeddings_store_service.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/base/dynamic_tool_service.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/base/embeddings_client.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/base/embeddings_service.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/base/flow.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/base/graph_embeddings_client.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/base/graph_embeddings_query_service.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/base/graph_embeddings_store_service.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/base/graph_rag_client.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/base/librarian_client.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/base/llm_service.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/base/logging.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/base/metrics.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/base/parameter_spec.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/base/producer.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/base/producer_spec.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/base/prompt_client.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/base/publisher.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/base/pubsub.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/base/pulsar_backend.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/base/rabbitmq_backend.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/base/request_response_spec.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/base/row_embeddings_query_client.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/base/serialization.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/base/spec.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/base/structured_query_client.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/base/subscriber.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/base/subscriber_spec.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/base/text_completion_client.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/base/tool_client.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/base/tool_service.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/base/tool_service_client.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/base/triples_client.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/base/triples_query_service.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/base/triples_store_service.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/clients/__init__.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/clients/agent_client.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/clients/base.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/clients/config_client.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/clients/document_embeddings_client.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/clients/document_rag_client.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/clients/embeddings_client.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/clients/graph_embeddings_client.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/clients/graph_rag_client.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/clients/llm_client.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/clients/prompt_client.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/clients/row_embeddings_client.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/clients/triples_query_client.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/exceptions.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/knowledge/__init__.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/knowledge/defs.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/knowledge/document.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/knowledge/identifier.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/knowledge/organization.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/knowledge/publication.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/log_level.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/messaging/__init__.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/messaging/registry.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/messaging/translators/__init__.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/messaging/translators/agent.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/messaging/translators/base.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/messaging/translators/collection.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/messaging/translators/config.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/messaging/translators/diagnosis.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/messaging/translators/document_loading.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/messaging/translators/embeddings.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/messaging/translators/embeddings_query.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/messaging/translators/flow.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/messaging/translators/knowledge.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/messaging/translators/library.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/messaging/translators/metadata.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/messaging/translators/nlp_query.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/messaging/translators/primitives.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/messaging/translators/prompt.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/messaging/translators/retrieval.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/messaging/translators/rows_query.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/messaging/translators/sparql_query.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/messaging/translators/structured_query.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/messaging/translators/text_completion.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/messaging/translators/tool.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/messaging/translators/triples.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/objects/__init__.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/objects/field.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/objects/object.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/provenance/__init__.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/provenance/agent.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/provenance/namespaces.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/provenance/triples.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/provenance/uris.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/provenance/vocabulary.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/rdf.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/schema/__init__.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/schema/core/__init__.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/schema/core/metadata.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/schema/core/primitives.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/schema/core/topic.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/schema/knowledge/__init__.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/schema/knowledge/document.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/schema/knowledge/embeddings.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/schema/knowledge/graph.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/schema/knowledge/knowledge.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/schema/knowledge/nlp.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/schema/knowledge/object.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/schema/knowledge/rows.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/schema/knowledge/structured.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/schema/services/__init__.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/schema/services/agent.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/schema/services/collection.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/schema/services/diagnosis.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/schema/services/flow.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/schema/services/library.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/schema/services/llm.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/schema/services/lookup.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/schema/services/nlp_query.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/schema/services/prompt.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/schema/services/query.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/schema/services/retrieval.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/schema/services/rows_query.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/schema/services/sparql_query.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/schema/services/storage.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/schema/services/structured_query.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/schema/services/tool_service.py +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph_base.egg-info/SOURCES.txt +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph_base.egg-info/dependency_links.txt +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph_base.egg-info/requires.txt +0 -0
- {trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/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.20
|
|
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,7 +1,8 @@
|
|
|
1
1
|
|
|
2
2
|
# Base class for processors. Implements:
|
|
3
|
-
# -
|
|
3
|
+
# - Pub/sub client, subscribe and consume basic
|
|
4
4
|
# - the async startup logic
|
|
5
|
+
# - Config notify handling with subscribe-then-fetch pattern
|
|
5
6
|
# - Initialising metrics
|
|
6
7
|
|
|
7
8
|
import asyncio
|
|
@@ -12,12 +13,17 @@ import logging
|
|
|
12
13
|
import os
|
|
13
14
|
from prometheus_client import start_http_server, Info
|
|
14
15
|
|
|
15
|
-
from .. schema import ConfigPush,
|
|
16
|
+
from .. schema import ConfigPush, ConfigRequest, ConfigResponse
|
|
17
|
+
from .. schema import config_push_queue, config_request_queue
|
|
18
|
+
from .. schema import config_response_queue
|
|
16
19
|
from .. log_level import LogLevel
|
|
17
20
|
from . pubsub import get_pubsub, add_pubsub_args
|
|
18
21
|
from . producer import Producer
|
|
19
22
|
from . consumer import Consumer
|
|
20
|
-
from .
|
|
23
|
+
from . subscriber import Subscriber
|
|
24
|
+
from . request_response_spec import RequestResponse
|
|
25
|
+
from . metrics import ProcessorMetrics, ConsumerMetrics, ProducerMetrics
|
|
26
|
+
from . metrics import SubscriberMetrics
|
|
21
27
|
from . logging import add_logging_args, setup_logging
|
|
22
28
|
|
|
23
29
|
default_config_queue = config_push_queue
|
|
@@ -57,9 +63,13 @@ class AsyncProcessor:
|
|
|
57
63
|
"config_push_queue", default_config_queue
|
|
58
64
|
)
|
|
59
65
|
|
|
60
|
-
# This records registered configuration handlers
|
|
66
|
+
# This records registered configuration handlers, each entry is:
|
|
67
|
+
# { "handler": async_fn, "types": set_or_none }
|
|
61
68
|
self.config_handlers = []
|
|
62
69
|
|
|
70
|
+
# Track the current config version for dedup
|
|
71
|
+
self.config_version = 0
|
|
72
|
+
|
|
63
73
|
# Create a random ID for this subscription to the configuration
|
|
64
74
|
# service
|
|
65
75
|
config_subscriber_id = str(uuid.uuid4())
|
|
@@ -68,8 +78,7 @@ class AsyncProcessor:
|
|
|
68
78
|
processor = self.id, flow = None, name = "config",
|
|
69
79
|
)
|
|
70
80
|
|
|
71
|
-
# Subscribe to config queue
|
|
72
|
-
# gets its own copy of config pushes (broadcast pattern)
|
|
81
|
+
# Subscribe to config notify queue
|
|
73
82
|
self.config_sub_task = Consumer(
|
|
74
83
|
|
|
75
84
|
taskgroup = self.taskgroup,
|
|
@@ -80,21 +89,93 @@ class AsyncProcessor:
|
|
|
80
89
|
topic = self.config_push_queue,
|
|
81
90
|
schema = ConfigPush,
|
|
82
91
|
|
|
83
|
-
handler = self.
|
|
92
|
+
handler = self.on_config_notify,
|
|
84
93
|
|
|
85
94
|
metrics = config_consumer_metrics,
|
|
86
95
|
|
|
87
|
-
start_of_messages =
|
|
96
|
+
start_of_messages = False,
|
|
88
97
|
consumer_type = 'exclusive',
|
|
89
98
|
)
|
|
90
99
|
|
|
91
100
|
self.running = True
|
|
92
101
|
|
|
93
|
-
|
|
94
|
-
|
|
102
|
+
def _create_config_client(self):
|
|
103
|
+
"""Create a short-lived config request/response client."""
|
|
104
|
+
config_rr_id = str(uuid.uuid4())
|
|
105
|
+
|
|
106
|
+
config_req_metrics = ProducerMetrics(
|
|
107
|
+
processor = self.id, flow = None, name = "config-request",
|
|
108
|
+
)
|
|
109
|
+
config_resp_metrics = SubscriberMetrics(
|
|
110
|
+
processor = self.id, flow = None, name = "config-response",
|
|
111
|
+
)
|
|
112
|
+
|
|
113
|
+
return RequestResponse(
|
|
114
|
+
backend = self.pubsub_backend,
|
|
115
|
+
subscription = f"{self.id}--config--{config_rr_id}",
|
|
116
|
+
consumer_name = self.id,
|
|
117
|
+
request_topic = config_request_queue,
|
|
118
|
+
request_schema = ConfigRequest,
|
|
119
|
+
request_metrics = config_req_metrics,
|
|
120
|
+
response_topic = config_response_queue,
|
|
121
|
+
response_schema = ConfigResponse,
|
|
122
|
+
response_metrics = config_resp_metrics,
|
|
123
|
+
)
|
|
124
|
+
|
|
125
|
+
async def fetch_config(self):
|
|
126
|
+
"""Fetch full config from config service using a short-lived
|
|
127
|
+
request/response client. Returns (config, version) or raises."""
|
|
128
|
+
client = self._create_config_client()
|
|
129
|
+
try:
|
|
130
|
+
await client.start()
|
|
131
|
+
resp = await client.request(
|
|
132
|
+
ConfigRequest(operation="config"),
|
|
133
|
+
timeout=10,
|
|
134
|
+
)
|
|
135
|
+
if resp.error:
|
|
136
|
+
raise RuntimeError(f"Config error: {resp.error.message}")
|
|
137
|
+
return resp.config, resp.version
|
|
138
|
+
finally:
|
|
139
|
+
await client.stop()
|
|
140
|
+
|
|
141
|
+
# This is called to start dynamic behaviour.
|
|
142
|
+
# Implements the subscribe-then-fetch pattern to avoid race conditions.
|
|
95
143
|
async def start(self):
|
|
144
|
+
|
|
145
|
+
# 1. Start the notify consumer (begins buffering incoming notifys)
|
|
96
146
|
await self.config_sub_task.start()
|
|
97
147
|
|
|
148
|
+
# 2. Fetch current config via request/response
|
|
149
|
+
await self.fetch_and_apply_config()
|
|
150
|
+
|
|
151
|
+
# 3. Any buffered notifys with version > fetched version will be
|
|
152
|
+
# processed by on_config_notify, which does the version check
|
|
153
|
+
|
|
154
|
+
async def fetch_and_apply_config(self):
|
|
155
|
+
"""Fetch full config from config service and apply to all handlers.
|
|
156
|
+
Retries until successful — config service may not be ready yet."""
|
|
157
|
+
|
|
158
|
+
while self.running:
|
|
159
|
+
|
|
160
|
+
try:
|
|
161
|
+
config, version = await self.fetch_config()
|
|
162
|
+
|
|
163
|
+
logger.info(f"Fetched config version {version}")
|
|
164
|
+
|
|
165
|
+
self.config_version = version
|
|
166
|
+
|
|
167
|
+
# Apply to all handlers (startup = invoke all)
|
|
168
|
+
for entry in self.config_handlers:
|
|
169
|
+
await entry["handler"](config, version)
|
|
170
|
+
|
|
171
|
+
return
|
|
172
|
+
|
|
173
|
+
except Exception as e:
|
|
174
|
+
logger.warning(
|
|
175
|
+
f"Config fetch failed: {e}, retrying in 2s..."
|
|
176
|
+
)
|
|
177
|
+
await asyncio.sleep(2)
|
|
178
|
+
|
|
98
179
|
# This is called to stop all threads. An over-ride point for extra
|
|
99
180
|
# functionality
|
|
100
181
|
def stop(self):
|
|
@@ -110,20 +191,66 @@ class AsyncProcessor:
|
|
|
110
191
|
def pulsar_host(self): return self._pulsar_host
|
|
111
192
|
|
|
112
193
|
# Register a new event handler for configuration change
|
|
113
|
-
def register_config_handler(self, handler):
|
|
114
|
-
self.config_handlers.append(
|
|
194
|
+
def register_config_handler(self, handler, types=None):
|
|
195
|
+
self.config_handlers.append({
|
|
196
|
+
"handler": handler,
|
|
197
|
+
"types": set(types) if types else None,
|
|
198
|
+
})
|
|
115
199
|
|
|
116
|
-
# Called when a
|
|
117
|
-
async def
|
|
200
|
+
# Called when a config notify message arrives
|
|
201
|
+
async def on_config_notify(self, message, consumer, flow):
|
|
202
|
+
|
|
203
|
+
notify_version = message.value().version
|
|
204
|
+
notify_types = set(message.value().types)
|
|
205
|
+
|
|
206
|
+
# Skip if we already have this version or newer
|
|
207
|
+
if notify_version <= self.config_version:
|
|
208
|
+
logger.debug(
|
|
209
|
+
f"Ignoring config notify v{notify_version}, "
|
|
210
|
+
f"already at v{self.config_version}"
|
|
211
|
+
)
|
|
212
|
+
return
|
|
213
|
+
|
|
214
|
+
# Check if any handler cares about the affected types
|
|
215
|
+
if notify_types:
|
|
216
|
+
any_interested = False
|
|
217
|
+
for entry in self.config_handlers:
|
|
218
|
+
handler_types = entry["types"]
|
|
219
|
+
if handler_types is None or notify_types & handler_types:
|
|
220
|
+
any_interested = True
|
|
221
|
+
break
|
|
222
|
+
|
|
223
|
+
if not any_interested:
|
|
224
|
+
logger.debug(
|
|
225
|
+
f"Ignoring config notify v{notify_version}, "
|
|
226
|
+
f"no handlers for types {notify_types}"
|
|
227
|
+
)
|
|
228
|
+
self.config_version = notify_version
|
|
229
|
+
return
|
|
118
230
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
231
|
+
logger.info(
|
|
232
|
+
f"Config notify v{notify_version} types={list(notify_types)}, "
|
|
233
|
+
f"fetching config..."
|
|
234
|
+
)
|
|
235
|
+
|
|
236
|
+
# Fetch full config using short-lived client
|
|
237
|
+
try:
|
|
238
|
+
config, version = await self.fetch_config()
|
|
239
|
+
|
|
240
|
+
self.config_version = version
|
|
122
241
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
242
|
+
# Invoke handlers that care about the affected types
|
|
243
|
+
for entry in self.config_handlers:
|
|
244
|
+
handler_types = entry["types"]
|
|
245
|
+
if handler_types is None:
|
|
246
|
+
await entry["handler"](config, version)
|
|
247
|
+
elif not notify_types or notify_types & handler_types:
|
|
248
|
+
await entry["handler"](config, version)
|
|
249
|
+
|
|
250
|
+
except Exception as e:
|
|
251
|
+
logger.error(
|
|
252
|
+
f"Failed to fetch config on notify: {e}", exc_info=True
|
|
253
|
+
)
|
|
127
254
|
|
|
128
255
|
# This is the 'main' body of the handler. It is a point to override
|
|
129
256
|
# if needed. By default does nothing. Processors are implemented
|
|
@@ -181,7 +308,7 @@ class AsyncProcessor:
|
|
|
181
308
|
prog=ident,
|
|
182
309
|
description=doc
|
|
183
310
|
)
|
|
184
|
-
|
|
311
|
+
|
|
185
312
|
parser.add_argument(
|
|
186
313
|
'--id',
|
|
187
314
|
default=ident,
|
|
@@ -271,4 +398,3 @@ class AsyncProcessor:
|
|
|
271
398
|
default=8000,
|
|
272
399
|
help=f'Pulsar host (default: 8000)',
|
|
273
400
|
)
|
|
274
|
-
|
|
@@ -26,7 +26,9 @@ class FlowProcessor(AsyncProcessor):
|
|
|
26
26
|
super(FlowProcessor, self).__init__(**params)
|
|
27
27
|
|
|
28
28
|
# Register configuration handler
|
|
29
|
-
self.register_config_handler(
|
|
29
|
+
self.register_config_handler(
|
|
30
|
+
self.on_configure_flows, types=["active-flow"]
|
|
31
|
+
)
|
|
30
32
|
|
|
31
33
|
# Initialise flow information state
|
|
32
34
|
self.flows = {}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "2.2.20"
|
|
@@ -58,11 +58,11 @@ class ConfigResponse:
|
|
|
58
58
|
@dataclass
|
|
59
59
|
class ConfigPush:
|
|
60
60
|
version: int = 0
|
|
61
|
-
|
|
61
|
+
types: list[str] = field(default_factory=list)
|
|
62
62
|
|
|
63
63
|
config_request_queue = queue('config', cls='request')
|
|
64
64
|
config_response_queue = queue('config', cls='response')
|
|
65
|
-
config_push_queue = queue('config', cls='
|
|
65
|
+
config_push_queue = queue('config', cls='flow')
|
|
66
66
|
|
|
67
67
|
############################################################################
|
|
68
68
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: trustgraph-base
|
|
3
|
-
Version: 2.2.
|
|
3
|
+
Version: 2.2.20
|
|
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.19"
|
|
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.19 → trustgraph_base-2.2.20}/trustgraph/base/collection_config_handler.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/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
|
{trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/base/graph_embeddings_client.py
RENAMED
|
File without changes
|
{trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/base/graph_embeddings_query_service.py
RENAMED
|
File without changes
|
{trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/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.19 → trustgraph_base-2.2.20}/trustgraph/base/row_embeddings_query_client.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/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
|
|
File without changes
|
{trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/clients/document_embeddings_client.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/clients/graph_embeddings_client.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/clients/row_embeddings_client.py
RENAMED
|
File without changes
|
{trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/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.19 → trustgraph_base-2.2.20}/trustgraph/messaging/translators/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/messaging/translators/collection.py
RENAMED
|
File without changes
|
{trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/messaging/translators/config.py
RENAMED
|
File without changes
|
{trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/messaging/translators/diagnosis.py
RENAMED
|
File without changes
|
|
File without changes
|
{trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/messaging/translators/embeddings.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/messaging/translators/knowledge.py
RENAMED
|
File without changes
|
{trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/messaging/translators/library.py
RENAMED
|
File without changes
|
{trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/messaging/translators/metadata.py
RENAMED
|
File without changes
|
{trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/messaging/translators/nlp_query.py
RENAMED
|
File without changes
|
{trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/messaging/translators/primitives.py
RENAMED
|
File without changes
|
{trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/messaging/translators/prompt.py
RENAMED
|
File without changes
|
{trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/messaging/translators/retrieval.py
RENAMED
|
File without changes
|
{trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/messaging/translators/rows_query.py
RENAMED
|
File without changes
|
{trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/messaging/translators/sparql_query.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/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
|
{trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/schema/services/sparql_query.py
RENAMED
|
File without changes
|
|
File without changes
|
{trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/schema/services/structured_query.py
RENAMED
|
File without changes
|
{trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph/schema/services/tool_service.py
RENAMED
|
File without changes
|
|
File without changes
|
{trustgraph_base-2.2.19 → trustgraph_base-2.2.20}/trustgraph_base.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|