trustgraph-base 0.22.0__tar.gz → 0.22.1__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.
Files changed (58) hide show
  1. {trustgraph-base-0.22.0 → trustgraph-base-0.22.1}/PKG-INFO +2 -2
  2. {trustgraph-base-0.22.0 → trustgraph-base-0.22.1}/trustgraph/api/api.py +0 -1
  3. {trustgraph-base-0.22.0 → trustgraph-base-0.22.1}/trustgraph/base/base_processor.py +56 -3
  4. {trustgraph-base-0.22.0 → trustgraph-base-0.22.1}/trustgraph/base/consumer.py +1 -1
  5. trustgraph-base-0.22.1/trustgraph/base_version.py +1 -0
  6. {trustgraph-base-0.22.0 → trustgraph-base-0.22.1}/trustgraph_base.egg-info/PKG-INFO +2 -2
  7. trustgraph-base-0.22.0/trustgraph/base_version.py +0 -1
  8. {trustgraph-base-0.22.0 → trustgraph-base-0.22.1}/README.md +0 -0
  9. {trustgraph-base-0.22.0 → trustgraph-base-0.22.1}/setup.cfg +0 -0
  10. {trustgraph-base-0.22.0 → trustgraph-base-0.22.1}/setup.py +0 -0
  11. {trustgraph-base-0.22.0 → trustgraph-base-0.22.1}/trustgraph/api/__init__.py +0 -0
  12. {trustgraph-base-0.22.0 → trustgraph-base-0.22.1}/trustgraph/base/__init__.py +0 -0
  13. {trustgraph-base-0.22.0 → trustgraph-base-0.22.1}/trustgraph/base/consumer_producer.py +0 -0
  14. {trustgraph-base-0.22.0 → trustgraph-base-0.22.1}/trustgraph/base/producer.py +0 -0
  15. {trustgraph-base-0.22.0 → trustgraph-base-0.22.1}/trustgraph/base/publisher.py +0 -0
  16. {trustgraph-base-0.22.0 → trustgraph-base-0.22.1}/trustgraph/base/subscriber.py +0 -0
  17. {trustgraph-base-0.22.0 → trustgraph-base-0.22.1}/trustgraph/clients/__init__.py +0 -0
  18. {trustgraph-base-0.22.0 → trustgraph-base-0.22.1}/trustgraph/clients/agent_client.py +0 -0
  19. {trustgraph-base-0.22.0 → trustgraph-base-0.22.1}/trustgraph/clients/base.py +0 -0
  20. {trustgraph-base-0.22.0 → trustgraph-base-0.22.1}/trustgraph/clients/config_client.py +0 -0
  21. {trustgraph-base-0.22.0 → trustgraph-base-0.22.1}/trustgraph/clients/document_embeddings_client.py +0 -0
  22. {trustgraph-base-0.22.0 → trustgraph-base-0.22.1}/trustgraph/clients/document_rag_client.py +0 -0
  23. {trustgraph-base-0.22.0 → trustgraph-base-0.22.1}/trustgraph/clients/embeddings_client.py +0 -0
  24. {trustgraph-base-0.22.0 → trustgraph-base-0.22.1}/trustgraph/clients/graph_embeddings_client.py +0 -0
  25. {trustgraph-base-0.22.0 → trustgraph-base-0.22.1}/trustgraph/clients/graph_rag_client.py +0 -0
  26. {trustgraph-base-0.22.0 → trustgraph-base-0.22.1}/trustgraph/clients/llm_client.py +0 -0
  27. {trustgraph-base-0.22.0 → trustgraph-base-0.22.1}/trustgraph/clients/prompt_client.py +0 -0
  28. {trustgraph-base-0.22.0 → trustgraph-base-0.22.1}/trustgraph/clients/triples_query_client.py +0 -0
  29. {trustgraph-base-0.22.0 → trustgraph-base-0.22.1}/trustgraph/exceptions.py +0 -0
  30. {trustgraph-base-0.22.0 → trustgraph-base-0.22.1}/trustgraph/knowledge/__init__.py +0 -0
  31. {trustgraph-base-0.22.0 → trustgraph-base-0.22.1}/trustgraph/knowledge/defs.py +0 -0
  32. {trustgraph-base-0.22.0 → trustgraph-base-0.22.1}/trustgraph/knowledge/document.py +0 -0
  33. {trustgraph-base-0.22.0 → trustgraph-base-0.22.1}/trustgraph/knowledge/identifier.py +0 -0
  34. {trustgraph-base-0.22.0 → trustgraph-base-0.22.1}/trustgraph/knowledge/organization.py +0 -0
  35. {trustgraph-base-0.22.0 → trustgraph-base-0.22.1}/trustgraph/knowledge/publication.py +0 -0
  36. {trustgraph-base-0.22.0 → trustgraph-base-0.22.1}/trustgraph/log_level.py +0 -0
  37. {trustgraph-base-0.22.0 → trustgraph-base-0.22.1}/trustgraph/objects/__init__.py +0 -0
  38. {trustgraph-base-0.22.0 → trustgraph-base-0.22.1}/trustgraph/objects/field.py +0 -0
  39. {trustgraph-base-0.22.0 → trustgraph-base-0.22.1}/trustgraph/objects/object.py +0 -0
  40. {trustgraph-base-0.22.0 → trustgraph-base-0.22.1}/trustgraph/rdf.py +0 -0
  41. {trustgraph-base-0.22.0 → trustgraph-base-0.22.1}/trustgraph/schema/__init__.py +0 -0
  42. {trustgraph-base-0.22.0 → trustgraph-base-0.22.1}/trustgraph/schema/agent.py +0 -0
  43. {trustgraph-base-0.22.0 → trustgraph-base-0.22.1}/trustgraph/schema/config.py +0 -0
  44. {trustgraph-base-0.22.0 → trustgraph-base-0.22.1}/trustgraph/schema/documents.py +0 -0
  45. {trustgraph-base-0.22.0 → trustgraph-base-0.22.1}/trustgraph/schema/graph.py +0 -0
  46. {trustgraph-base-0.22.0 → trustgraph-base-0.22.1}/trustgraph/schema/library.py +0 -0
  47. {trustgraph-base-0.22.0 → trustgraph-base-0.22.1}/trustgraph/schema/lookup.py +0 -0
  48. {trustgraph-base-0.22.0 → trustgraph-base-0.22.1}/trustgraph/schema/metadata.py +0 -0
  49. {trustgraph-base-0.22.0 → trustgraph-base-0.22.1}/trustgraph/schema/models.py +0 -0
  50. {trustgraph-base-0.22.0 → trustgraph-base-0.22.1}/trustgraph/schema/object.py +0 -0
  51. {trustgraph-base-0.22.0 → trustgraph-base-0.22.1}/trustgraph/schema/prompt.py +0 -0
  52. {trustgraph-base-0.22.0 → trustgraph-base-0.22.1}/trustgraph/schema/retrieval.py +0 -0
  53. {trustgraph-base-0.22.0 → trustgraph-base-0.22.1}/trustgraph/schema/topic.py +0 -0
  54. {trustgraph-base-0.22.0 → trustgraph-base-0.22.1}/trustgraph/schema/types.py +0 -0
  55. {trustgraph-base-0.22.0 → trustgraph-base-0.22.1}/trustgraph_base.egg-info/SOURCES.txt +0 -0
  56. {trustgraph-base-0.22.0 → trustgraph-base-0.22.1}/trustgraph_base.egg-info/dependency_links.txt +0 -0
  57. {trustgraph-base-0.22.0 → trustgraph-base-0.22.1}/trustgraph_base.egg-info/requires.txt +0 -0
  58. {trustgraph-base-0.22.0 → trustgraph-base-0.22.1}/trustgraph_base.egg-info/top_level.txt +0 -0
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: trustgraph-base
3
- Version: 0.22.0
3
+ Version: 0.22.1
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
  Home-page: https://github.com/trustgraph-ai/trustgraph
6
- Download-URL: https://github.com/trustgraph-ai/trustgraph/archive/refs/tags/v0.22.0.tar.gz
6
+ Download-URL: https://github.com/trustgraph-ai/trustgraph/archive/refs/tags/v0.22.1.tar.gz
7
7
  Author: trustgraph.ai
8
8
  Author-email: security@trustgraph.ai
9
9
  Classifier: Programming Language :: Python :: 3
@@ -411,4 +411,3 @@ class Api:
411
411
  except:
412
412
  raise ProtocolException(f"Response not formatted correctly")
413
413
 
414
-
@@ -3,12 +3,18 @@ import asyncio
3
3
  import os
4
4
  import argparse
5
5
  import pulsar
6
+ from pulsar.schema import JsonSchema
6
7
  import _pulsar
7
8
  import time
9
+ import uuid
8
10
  from prometheus_client import start_http_server, Info
9
11
 
12
+ from .. schema import ConfigPush, config_push_queue
10
13
  from .. log_level import LogLevel
11
14
 
15
+ default_config_queue = config_push_queue
16
+ config_subscriber_id = str(uuid.uuid4())
17
+
12
18
  class BaseProcessor:
13
19
 
14
20
  default_pulsar_host = os.getenv("PULSAR_HOST", 'pulsar://pulsar:6650')
@@ -34,6 +40,11 @@ class BaseProcessor:
34
40
  pulsar_api_key = params.get("pulsar_api_key", None)
35
41
  log_level = params.get("log_level", LogLevel.INFO)
36
42
 
43
+ self.config_push_queue = params.get(
44
+ "config_push_queue",
45
+ default_config_queue
46
+ )
47
+
37
48
  self.pulsar_host = pulsar_host
38
49
  self.pulsar_api_key = pulsar_api_key
39
50
 
@@ -53,6 +64,12 @@ class BaseProcessor:
53
64
 
54
65
  self.pulsar_listener = pulsar_listener
55
66
 
67
+ self.config_subscriber = self.client.subscribe(
68
+ self.config_push_queue, config_subscriber_id,
69
+ consumer_type=pulsar.ConsumerType.Shared,
70
+ schema=JsonSchema(ConfigPush),
71
+ )
72
+
56
73
  def __del__(self):
57
74
 
58
75
  if hasattr(self, "client"):
@@ -74,6 +91,12 @@ class BaseProcessor:
74
91
  help=f'Pulsar API key',
75
92
  )
76
93
 
94
+ parser.add_argument(
95
+ '--config-push-queue',
96
+ default=default_config_queue,
97
+ help=f'Config push queue {default_config_queue}',
98
+ )
99
+
77
100
  parser.add_argument(
78
101
  '--pulsar-listener',
79
102
  help=f'Pulsar listener (default: none)',
@@ -104,14 +127,44 @@ class BaseProcessor:
104
127
  async def start(self):
105
128
  pass
106
129
 
130
+ async def run_config_queue(self):
131
+
132
+ if self.module == "config.service":
133
+ print("I am config-svc, not looking at config queue", flush=True)
134
+ return
135
+
136
+ print("Config thread running", flush=True)
137
+
138
+ while True:
139
+
140
+ try:
141
+ msg = await asyncio.to_thread(
142
+ self.config_subscriber.receive, timeout_millis=2000
143
+ )
144
+ except pulsar.Timeout:
145
+ continue
146
+
147
+ v = msg.value()
148
+ print("Got config version", v.version, flush=True)
149
+
150
+ await self.on_config(v.version, v.config)
151
+
152
+ async def on_config(self, version, config):
153
+ pass
154
+
107
155
  async def run(self):
108
156
  raise RuntimeError("Something should have implemented the run method")
109
157
 
110
158
  @classmethod
111
- async def launch_async(cls, args):
159
+ async def launch_async(cls, args, prog):
112
160
  p = cls(**args)
161
+ p.module = prog
113
162
  await p.start()
114
- await p.run()
163
+
164
+ task1 = asyncio.create_task(p.run_config_queue())
165
+ task2 = asyncio.create_task(p.run())
166
+
167
+ await asyncio.gather(task1, task2)
115
168
 
116
169
  @classmethod
117
170
  def launch(cls, prog, doc):
@@ -135,7 +188,7 @@ class BaseProcessor:
135
188
 
136
189
  try:
137
190
 
138
- asyncio.run(cls.launch_async(args))
191
+ asyncio.run(cls.launch_async(args, prog))
139
192
 
140
193
  except KeyboardInterrupt:
141
194
  print("Keyboard interrupt.")
@@ -82,7 +82,7 @@ class Consumer(BaseProcessor):
82
82
 
83
83
  while True:
84
84
 
85
- msg = self.consumer.receive()
85
+ msg = await asyncio.to_thread(self.consumer.receive)
86
86
 
87
87
  expiry = time.time() + self.rate_limit_timeout
88
88
 
@@ -0,0 +1 @@
1
+ __version__ = "0.22.1"
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: trustgraph-base
3
- Version: 0.22.0
3
+ Version: 0.22.1
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
  Home-page: https://github.com/trustgraph-ai/trustgraph
6
- Download-URL: https://github.com/trustgraph-ai/trustgraph/archive/refs/tags/v0.22.0.tar.gz
6
+ Download-URL: https://github.com/trustgraph-ai/trustgraph/archive/refs/tags/v0.22.1.tar.gz
7
7
  Author: trustgraph.ai
8
8
  Author-email: security@trustgraph.ai
9
9
  Classifier: Programming Language :: Python :: 3
@@ -1 +0,0 @@
1
- __version__ = "0.22.0"