indexify 0.2.13__py3-none-any.whl → 0.2.15__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.
@@ -153,7 +153,7 @@ class Graph:
153
153
  start_node = self.nodes[self._start_node]
154
154
  start_node = FunctionMetadata(
155
155
  name=start_node.name,
156
- fn_name=start_node.fn_name,
156
+ fn_name=start_node.name,
157
157
  description=start_node.description,
158
158
  reducer=start_node.accumulate is not None,
159
159
  image_name=start_node.image._image_name,
@@ -209,13 +209,15 @@ class Graph:
209
209
  k: IndexifyData(payload=serializer.serialize(v))
210
210
  }
211
211
  self._results[input.id] = outputs
212
- self._run(input, outputs)
212
+ enable_cache = kwargs.get('enable_cache', True)
213
+ self._run(input, outputs,enable_cache)
213
214
  return input.id
214
215
 
215
216
  def _run(
216
217
  self,
217
218
  initial_input: IndexifyData,
218
219
  outputs: Dict[str, List[bytes]],
220
+ enable_cache: bool
219
221
  ):
220
222
  accumulator_values = self._accumulator_values[initial_input.id]
221
223
  queue = deque([(self._start_node, initial_input)])
@@ -227,7 +229,7 @@ class Graph:
227
229
  cached_output_bytes: Optional[bytes] = self._cache.get(
228
230
  self.name, node_name, input_bytes
229
231
  )
230
- if cached_output_bytes is not None:
232
+ if cached_output_bytes is not None and enable_cache:
231
233
  print(
232
234
  f"ran {node_name}: num outputs: {len(cached_output_bytes)} (cache hit)"
233
235
  )
@@ -79,6 +79,10 @@ class IndexifyFunction(ABC):
79
79
 
80
80
  return partial(self.run, **kwargs)
81
81
 
82
+ @classmethod
83
+ def deserialize_output(cls, output: IndexifyData) -> Any:
84
+ serializer = get_serializer(cls.payload_encoder)
85
+ return serializer.deserialize(output.payload)
82
86
 
83
87
  class IndexifyRouter(ABC):
84
88
  name: str = ""
@@ -265,7 +269,3 @@ class IndexifyFunctionWrapper:
265
269
  payload = list(payload.values())[0]
266
270
  return arg_type.model_validate(payload)
267
271
  return payload
268
-
269
- def deserialize_fn_output(self, output: IndexifyData) -> Any:
270
- serializer = get_serializer(self.indexify_function.payload_encoder)
271
- return serializer.deserialize(output.payload)
indexify/http_client.py CHANGED
@@ -13,7 +13,7 @@ from rich import print
13
13
  from indexify.error import ApiException
14
14
  from indexify.functions_sdk.data_objects import IndexifyData
15
15
  from indexify.functions_sdk.graph import ComputeGraphMetadata, Graph
16
- from indexify.functions_sdk.indexify_functions import IndexifyFunctionWrapper
16
+ from indexify.functions_sdk.indexify_functions import IndexifyFunction
17
17
  from indexify.settings import DEFAULT_SERVICE_URL, DEFAULT_SERVICE_URL_HTTPS
18
18
 
19
19
 
@@ -71,7 +71,7 @@ class IndexifyClient:
71
71
  self._service_url = service_url
72
72
  self._timeout = kwargs.get("timeout")
73
73
  self._graphs: Dict[str, Graph] = {}
74
- self._fns = {}
74
+ self._fns: Dict[str, IndexifyFunction] = {}
75
75
 
76
76
  def _request(self, method: str, **kwargs) -> httpx.Response:
77
77
  try:
@@ -79,7 +79,7 @@ class IndexifyClient:
79
79
  status_code = str(response.status_code)
80
80
  if status_code.startswith("4"):
81
81
  raise ApiException(
82
- "status code: " + status_code + " request args: " + str(kwargs)
82
+ "status code: " + status_code + " message: " + response.text
83
83
  )
84
84
  if status_code.startswith("5"):
85
85
  raise ApiException(response.text)
@@ -181,14 +181,12 @@ class IndexifyClient:
181
181
  response = self._get(f"namespaces/{self.namespace}/compute_graphs/{name}")
182
182
  return ComputeGraphMetadata(**response.json())
183
183
 
184
- def load_fn_wrapper(self, name: str, fn_name: str) -> IndexifyFunctionWrapper:
184
+ def load_fn(self, name: str, fn_name: str) -> IndexifyFunction:
185
185
  response = self._get(
186
186
  f"internal/namespaces/{self.namespace}/compute_graphs/{name}/code"
187
187
  )
188
188
  pickled_functions_by_name = cloudpickle.loads(response.content)
189
- return IndexifyFunctionWrapper(
190
- cloudpickle.loads(pickled_functions_by_name[fn_name])
191
- )
189
+ return cloudpickle.loads(pickled_functions_by_name[fn_name])
192
190
 
193
191
  def namespaces(self) -> List[str]:
194
192
  response = self._get(f"namespaces")
@@ -323,7 +321,7 @@ class IndexifyClient:
323
321
  """
324
322
  fn_key = f"{graph}/{fn_name}"
325
323
  if fn_key not in self._fns:
326
- self._fns[fn_key] = self.load_fn_wrapper(graph, fn_name)
324
+ self._fns[fn_key] = self.load_fn(graph, fn_name)
327
325
  response = self._get(
328
326
  f"namespaces/{self.namespace}/compute_graphs/{graph}/invocations/{invocation_id}/outputs",
329
327
  )
@@ -335,7 +333,7 @@ class IndexifyClient:
335
333
  indexify_data = self._download_output(
336
334
  self.namespace, graph, invocation_id, fn_name, output.id
337
335
  )
338
- output = self._fns[fn_key].deserialize_fn_output(indexify_data)
336
+ output = self._fns[fn_key].deserialize_output(indexify_data)
339
337
  outputs.append(output)
340
338
  return outputs
341
339
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: indexify
3
- Version: 0.2.13
3
+ Version: 0.2.15
4
4
  Summary: Python Client for Indexify
5
5
  Home-page: https://github.com/tensorlakeai/indexify
6
6
  License: Apache 2.0
@@ -13,7 +13,8 @@ Classifier: Programming Language :: Python :: 3.9
13
13
  Classifier: Programming Language :: Python :: 3.10
14
14
  Classifier: Programming Language :: Python :: 3.11
15
15
  Classifier: Programming Language :: Python :: 3.12
16
- Requires-Dist: cloudpickle (>=3,<4)
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Requires-Dist: cloudpickle (>=3.1.0,<4.0.0)
17
18
  Requires-Dist: docker (>=7.1.0,<8.0.0)
18
19
  Requires-Dist: httpx-sse (>=0.4.0,<0.5.0)
19
20
  Requires-Dist: httpx[http2] (>=0,<1)
@@ -21,7 +22,7 @@ Requires-Dist: msgpack (>=1.1.0,<2.0.0)
21
22
  Requires-Dist: nanoid (>=2.0.0,<3.0.0)
22
23
  Requires-Dist: pydantic (>=2.9.2,<3.0.0)
23
24
  Requires-Dist: pyyaml (>=6,<7)
24
- Requires-Dist: rich (>=13,<14)
25
+ Requires-Dist: rich (>=13.9.2,<14.0.0)
25
26
  Requires-Dist: typer (>=0.12.5,<0.13.0)
26
27
  Project-URL: Repository, https://github.com/tensorlakeai/indexify
27
28
  Description-Content-Type: text/markdown
@@ -14,20 +14,20 @@ indexify/executor/runtime_probes.py,sha256=L-nB4D2zBZ287xxPwErv5R_gxFOmTEvg61FMe
14
14
  indexify/executor/task_reporter.py,sha256=gnnse0v6rjjni8lNzeb-ZYq6iF2DgafKoT7dcGUZhQ4,3716
15
15
  indexify/executor/task_store.py,sha256=q8s2gImsFffWeXQR0mk1Xlo1Aj_2GfclNPjQ2EA_YBo,3984
16
16
  indexify/functions_sdk/data_objects.py,sha256=CQZMzYiV7l6dyzFkYquWQHqdte6JnC7XA3i2ZyvPvgQ,844
17
- indexify/functions_sdk/graph.py,sha256=t35z26jRCBgoz7fncdlAL7MVTOYjeJuoPpz-xI7WjBw,11827
17
+ indexify/functions_sdk/graph.py,sha256=3hUZjdCesiAHJ9y1_heQsEFO-WHROR4kRYxBtVnb7Y4,11937
18
18
  indexify/functions_sdk/graph_definition.py,sha256=EJfC0MdKEbFF1CBaU0htrveSlcAQJCH96DLSNfZ02V4,1178
19
19
  indexify/functions_sdk/graph_validation.py,sha256=XLHiC9PAtZungJLysU3hIUOPNDkO5TXUDZ_jiZ0H4hg,2508
20
20
  indexify/functions_sdk/image.py,sha256=Rsol3LfE15Kca78ruPfDrDPqCkeZPxZx0ULYrFFS5ig,905
21
- indexify/functions_sdk/indexify_functions.py,sha256=QnumxE0Ln_ryyyjLMopjCGZQUGSX7N25PRpisIdEEXI,9600
21
+ indexify/functions_sdk/indexify_functions.py,sha256=KTEbTs-waqXTKC5e2f1MWxShr87nwJd3PgNEL3QMvIU,9593
22
22
  indexify/functions_sdk/local_cache.py,sha256=cNWF67zbhbTJe3g86hyLBy3Rqzs6dNvp2SjLazGZWvw,1348
23
23
  indexify/functions_sdk/object_serializer.py,sha256=Zz4GobW3ZamBBtFDF76QxU3TP6oJNdWnhsfKd0OUFoc,1660
24
24
  indexify/functions_sdk/pipeline.py,sha256=7hDatRK-SCHYvttf2Vj5YFyiJEVU0OOXEZBOIQenSmk,847
25
- indexify/http_client.py,sha256=x9ABHWc_oQH8_fa5qwFi53D10m9ibhrjvfw_OkTJfhc,13643
25
+ indexify/http_client.py,sha256=x92EbFD987pIxuBVVQZ-eN9nSL-oI2vpfv6OSKuBGgs,13589
26
26
  indexify/remote_graph.py,sha256=ILg6IY6EFgyvnfz1DSzicBZhqvPkg2-UUwgI6lxp6sA,3094
27
27
  indexify/remote_pipeline.py,sha256=FW7IAv3r24OOpiqlprw3kuFrpdkqi6Ic4_tT26FThjA,761
28
28
  indexify/settings.py,sha256=LSaWZ0ADIVmUv6o6dHWRC3-Ry5uLbCw2sBSg1e_U7UM,99
29
- indexify-0.2.13.dist-info/LICENSE.txt,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
30
- indexify-0.2.13.dist-info/METADATA,sha256=urBxY_dtcmMIfTd_UQvHq0efxq4-LHJahRGEOM0WYhE,6132
31
- indexify-0.2.13.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
32
- indexify-0.2.13.dist-info/entry_points.txt,sha256=Pih7WV-XMpAzI5dEvROcpLr-ybVhd9Y-AtuzBKUdcDs,49
33
- indexify-0.2.13.dist-info/RECORD,,
29
+ indexify-0.2.15.dist-info/LICENSE.txt,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
30
+ indexify-0.2.15.dist-info/METADATA,sha256=6iDb6m_2f2tjoA9y4630Z6j23ymDLGmoNjkIIyV1kxA,6199
31
+ indexify-0.2.15.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
32
+ indexify-0.2.15.dist-info/entry_points.txt,sha256=Pih7WV-XMpAzI5dEvROcpLr-ybVhd9Y-AtuzBKUdcDs,49
33
+ indexify-0.2.15.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 1.9.0
2
+ Generator: poetry-core 1.9.1
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any