indexify 0.2.31__py3-none-any.whl → 0.2.32__py3-none-any.whl

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.
@@ -210,6 +210,7 @@ class Graph:
210
210
  )
211
211
 
212
212
  def run(self, block_until_done: bool = False, **kwargs) -> str:
213
+ self.validate_graph()
213
214
  start_node = self.nodes[self._start_node]
214
215
  serializer = get_serializer(start_node.encoder)
215
216
  input = IndexifyData(
@@ -236,6 +237,35 @@ class Graph:
236
237
  self._run(input, outputs)
237
238
  return input.id
238
239
 
240
+ def validate_graph(self) -> None:
241
+ """
242
+ A method to validate that each node in the graph is
243
+ reachable from start node using BFS.
244
+ """
245
+ total_number_of_nodes = len(self.nodes)
246
+ queue = deque([self._start_node])
247
+ visited = {self._start_node}
248
+
249
+ while queue:
250
+ current_node_name = queue.popleft()
251
+ neighbours = (
252
+ self.edges[current_node_name]
253
+ if self.edges[current_node_name]
254
+ else self.routers[current_node_name]
255
+ )
256
+ for neighbour in neighbours:
257
+ if neighbour in visited:
258
+ continue
259
+ else:
260
+ visited.add(neighbour)
261
+ queue.append(neighbour)
262
+
263
+ if total_number_of_nodes != len(visited):
264
+ # all the nodes are not reachable from the start_node.
265
+ raise Exception(
266
+ "Some nodes in the graph are not reachable from start node."
267
+ )
268
+
239
269
  def _run(
240
270
  self,
241
271
  initial_input: IndexifyData,
@@ -275,7 +305,7 @@ class Graph:
275
305
  self, node_name: str, input: IndexifyData
276
306
  ) -> Optional[Union[RouterCallResult, FunctionCallResult]]:
277
307
  node = self.nodes[node_name]
278
- if node_name in self.routers:
308
+ if node_name in self.routers and len(self.routers[node_name]) > 0:
279
309
  result = IndexifyFunctionWrapper(node, self._local_graph_ctx).invoke_router(
280
310
  node_name, input
281
311
  )
indexify/remote_graph.py CHANGED
@@ -90,6 +90,7 @@ class RemoteGraph:
90
90
  :param client: The IndexifyClient used to communicate with the server.
91
91
  Prefered over server_url.
92
92
  """
93
+ g.validate_graph()
93
94
  if not client:
94
95
  client = IndexifyClient(service_url=server_url)
95
96
  client.register_compute_graph(g, additional_modules)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: indexify
3
- Version: 0.2.31
3
+ Version: 0.2.32
4
4
  Summary: Python Client for Indexify
5
5
  Home-page: https://github.com/tensorlakeai/indexify
6
6
  License: Apache 2.0
@@ -20,7 +20,7 @@ Requires-Dist: httpx-sse (>=0.4.0,<0.5.0)
20
20
  Requires-Dist: httpx[http2] (>=0,<1)
21
21
  Requires-Dist: jsonpickle (>=4.0.0,<5.0.0)
22
22
  Requires-Dist: nanoid (>=2.0.0,<3.0.0)
23
- Requires-Dist: pydantic (>=2.9.2,<3.0.0)
23
+ Requires-Dist: pydantic (==2.10.2)
24
24
  Requires-Dist: pyyaml (>=6,<7)
25
25
  Requires-Dist: rich (>=13.9.2,<14.0.0)
26
26
  Requires-Dist: typer (>=0.13.0,<0.14.0)
@@ -16,7 +16,7 @@ indexify/executor/runtime_probes.py,sha256=mjw2_mGQ622wRT_39WPGGgPEZQTgtrf3-ICcU
16
16
  indexify/executor/task_reporter.py,sha256=4unHxLUHedKwIoqO3e5YdDJpUe_pJng-vHReoqcPNNU,5141
17
17
  indexify/executor/task_store.py,sha256=JlRlWwAm4YjFRkTNRx-6GsUcmOzcyvzb5Csa5XDpRTI,3982
18
18
  indexify/functions_sdk/data_objects.py,sha256=wXbUa9hjU6rsXmmk19vQ5Kixf3FsI59VBWPNmHasAX0,854
19
- indexify/functions_sdk/graph.py,sha256=_XsHfkQaxTnBNVcDlq4KsnyZ0HQ_DZOAuwygDzpsCNo,11805
19
+ indexify/functions_sdk/graph.py,sha256=ewm-XUlqIXA0RSl1JxU91yT2XXK3WRqrD9_YSvlK_44,12884
20
20
  indexify/functions_sdk/graph_definition.py,sha256=UeC0PMchgZgo2T0Goog0SW1lIRdFf6ug4iHOS9ItRvI,1622
21
21
  indexify/functions_sdk/graph_validation.py,sha256=mN2Fcp91GIwFZEQP6z_qGqt4LkLM70SnI7AWBi4CmKQ,2509
22
22
  indexify/functions_sdk/image.py,sha256=QK0H6KxLWriB_z4M0kunKzzHdHxYLWL670RPYgYuf_8,1762
@@ -25,11 +25,11 @@ indexify/functions_sdk/local_cache.py,sha256=cNWF67zbhbTJe3g86hyLBy3Rqzs6dNvp2Sj
25
25
  indexify/functions_sdk/object_serializer.py,sha256=pOgUOWbRNRix9uZT0aQn0LTCnJCeMNGO1nAE0jAybmg,1546
26
26
  indexify/functions_sdk/pipeline.py,sha256=KmxZE8eBFAQ4bbEcYURXXR26HSyoAT3O6iu9H38-OXE,974
27
27
  indexify/http_client.py,sha256=5d70A6j2vJBn3OfUVjrQvnPml07p7fxOXWBUAUfAkiU,15915
28
- indexify/remote_graph.py,sha256=CWfFxB0jlx8Zgp_xUjvjgrIwv-yNAfEbQwlXt3jfRNM,4976
28
+ indexify/remote_graph.py,sha256=aox9NibZIU8YDiP92syerFSjiZc2jVPkF6g2kfqOvCA,5003
29
29
  indexify/remote_pipeline.py,sha256=oqx57rSPszNS3DToXO_nf-CKqkCZWptm1u_p3orV_gQ,790
30
30
  indexify/settings.py,sha256=Ny59mzYI4gbXoK8hjx66a_men6ndbd1J1zCTcKOoyzg,50
31
- indexify-0.2.31.dist-info/LICENSE.txt,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
32
- indexify-0.2.31.dist-info/METADATA,sha256=Jrl1EVAJoI1uYMYKaA1pofIao2iV8FhfytvxEHXZvCE,6202
33
- indexify-0.2.31.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
34
- indexify-0.2.31.dist-info/entry_points.txt,sha256=Pih7WV-XMpAzI5dEvROcpLr-ybVhd9Y-AtuzBKUdcDs,49
35
- indexify-0.2.31.dist-info/RECORD,,
31
+ indexify-0.2.32.dist-info/LICENSE.txt,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
32
+ indexify-0.2.32.dist-info/METADATA,sha256=3-sKMgJvXaZByfEAUE6h2fBtymF3pw7MXhXvv9gwhnU,6196
33
+ indexify-0.2.32.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
34
+ indexify-0.2.32.dist-info/entry_points.txt,sha256=Pih7WV-XMpAzI5dEvROcpLr-ybVhd9Y-AtuzBKUdcDs,49
35
+ indexify-0.2.32.dist-info/RECORD,,