indexify 0.2.9__tar.gz → 0.2.11__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 (30) hide show
  1. {indexify-0.2.9 → indexify-0.2.11}/PKG-INFO +1 -1
  2. {indexify-0.2.9 → indexify-0.2.11}/indexify/cli.py +3 -1
  3. {indexify-0.2.9 → indexify-0.2.11}/indexify/executor/function_worker.py +9 -2
  4. {indexify-0.2.9 → indexify-0.2.11}/indexify/functions_sdk/graph.py +5 -2
  5. {indexify-0.2.9 → indexify-0.2.11}/indexify/http_client.py +15 -6
  6. {indexify-0.2.9 → indexify-0.2.11}/indexify/remote_graph.py +8 -6
  7. {indexify-0.2.9 → indexify-0.2.11}/pyproject.toml +1 -1
  8. {indexify-0.2.9 → indexify-0.2.11}/LICENSE.txt +0 -0
  9. {indexify-0.2.9 → indexify-0.2.11}/README.md +0 -0
  10. {indexify-0.2.9 → indexify-0.2.11}/indexify/__init__.py +0 -0
  11. {indexify-0.2.9 → indexify-0.2.11}/indexify/data_loaders/__init__.py +0 -0
  12. {indexify-0.2.9 → indexify-0.2.11}/indexify/data_loaders/local_directory_loader.py +0 -0
  13. {indexify-0.2.9 → indexify-0.2.11}/indexify/data_loaders/url_loader.py +0 -0
  14. {indexify-0.2.9 → indexify-0.2.11}/indexify/error.py +0 -0
  15. {indexify-0.2.9 → indexify-0.2.11}/indexify/executor/agent.py +0 -0
  16. {indexify-0.2.9 → indexify-0.2.11}/indexify/executor/api_objects.py +0 -0
  17. {indexify-0.2.9 → indexify-0.2.11}/indexify/executor/downloader.py +0 -0
  18. {indexify-0.2.9 → indexify-0.2.11}/indexify/executor/executor_tasks.py +0 -0
  19. {indexify-0.2.9 → indexify-0.2.11}/indexify/executor/indexify_executor.py +0 -0
  20. {indexify-0.2.9 → indexify-0.2.11}/indexify/executor/runtime_probes.py +0 -0
  21. {indexify-0.2.9 → indexify-0.2.11}/indexify/executor/task_reporter.py +0 -0
  22. {indexify-0.2.9 → indexify-0.2.11}/indexify/executor/task_store.py +0 -0
  23. {indexify-0.2.9 → indexify-0.2.11}/indexify/functions_sdk/data_objects.py +0 -0
  24. {indexify-0.2.9 → indexify-0.2.11}/indexify/functions_sdk/graph_definition.py +0 -0
  25. {indexify-0.2.9 → indexify-0.2.11}/indexify/functions_sdk/graph_validation.py +0 -0
  26. {indexify-0.2.9 → indexify-0.2.11}/indexify/functions_sdk/image.py +0 -0
  27. {indexify-0.2.9 → indexify-0.2.11}/indexify/functions_sdk/indexify_functions.py +0 -0
  28. {indexify-0.2.9 → indexify-0.2.11}/indexify/functions_sdk/local_cache.py +0 -0
  29. {indexify-0.2.9 → indexify-0.2.11}/indexify/functions_sdk/object_serializer.py +0 -0
  30. {indexify-0.2.9 → indexify-0.2.11}/indexify/settings.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: indexify
3
- Version: 0.2.9
3
+ Version: 0.2.11
4
4
  Summary: Python Client for Indexify
5
5
  Home-page: https://github.com/tensorlakeai/indexify
6
6
  License: Apache 2.0
@@ -119,7 +119,9 @@ def server_dev_mode():
119
119
 
120
120
  @app.command(help="Build image for function names")
121
121
  def build_image(
122
- workflow_file_path: str, func_names: List[str], python_sdk_path: Optional[str] = None
122
+ workflow_file_path: str,
123
+ func_names: List[str],
124
+ python_sdk_path: Optional[str] = None,
123
125
  ):
124
126
  globals_dict = {}
125
127
 
@@ -18,6 +18,7 @@ function_wrapper_map: Dict[str, IndexifyFunctionWrapper] = {}
18
18
 
19
19
  import concurrent.futures
20
20
 
21
+
21
22
  class FunctionRunException(Exception):
22
23
  def __init__(
23
24
  self, exception: Exception, stdout: str, stderr: str, is_reducer: bool
@@ -131,7 +132,9 @@ def _run_function(
131
132
  fn_output = None
132
133
  has_failed = False
133
134
  exception_msg = None
134
- print(f"[bold] function_worker: [/bold] invoking function {fn_name} in graph {graph_name}")
135
+ print(
136
+ f"[bold] function_worker: [/bold] invoking function {fn_name} in graph {graph_name}"
137
+ )
135
138
  with redirect_stdout(stdout_capture), redirect_stderr(stderr_capture):
136
139
  try:
137
140
  key = f"{namespace}/{graph_name}/{version}/{fn_name}"
@@ -139,7 +142,10 @@ def _run_function(
139
142
  _load_function(namespace, graph_name, fn_name, code_path, version)
140
143
 
141
144
  fn = function_wrapper_map[key]
142
- if str(type(fn.indexify_function)) == "<class 'indexify.functions_sdk.indexify_functions.IndexifyRo'>":
145
+ if (
146
+ str(type(fn.indexify_function))
147
+ == "<class 'indexify.functions_sdk.indexify_functions.IndexifyRo'>"
148
+ ):
143
149
  router_output = fn.invoke_router(fn_name, input)
144
150
  else:
145
151
  fn_output = fn.invoke_fn_ser(fn_name, input, init_value)
@@ -147,6 +153,7 @@ def _run_function(
147
153
  is_reducer = fn.indexify_function.accumulate is not None
148
154
  except Exception as e:
149
155
  import sys
156
+
150
157
  print(traceback.format_exc(), file=sys.stderr)
151
158
  has_failed = True
152
159
  exception_msg = str(e)
@@ -117,13 +117,16 @@ class Graph:
117
117
  self.routers[from_node.name].append(node.name)
118
118
  return self
119
119
 
120
- def serialize(self):
120
+ def serialize(self, additional_modules):
121
121
  # Get all unique modules from nodes and edges
122
122
  pickled_functions = {}
123
+ for module in additional_modules:
124
+ cloudpickle.register_pickle_by_value(module)
123
125
  for node in self.nodes.values():
124
126
  cloudpickle.register_pickle_by_value(sys.modules[node.__module__])
125
127
  pickled_functions[node.name] = cloudpickle.dumps(node)
126
- cloudpickle.unregister_pickle_by_value(sys.modules[node.__module__])
128
+ if not sys.modules[node.__module__] in additional_modules:
129
+ cloudpickle.unregister_pickle_by_value(sys.modules[node.__module__])
127
130
  return pickled_functions
128
131
 
129
132
  def add_edge(
@@ -160,9 +160,9 @@ class IndexifyClient:
160
160
  def __exit__(self, exc_type, exc_value, traceback):
161
161
  self.close()
162
162
 
163
- def register_compute_graph(self, graph: Graph):
163
+ def register_compute_graph(self, graph: Graph, additional_modules):
164
164
  graph_metadata = graph.definition()
165
- serialized_code = cloudpickle.dumps(graph.serialize())
165
+ serialized_code = cloudpickle.dumps(graph.serialize(additional_modules))
166
166
  response = self._post(
167
167
  f"namespaces/{self.namespace}/compute_graphs",
168
168
  files={"code": serialized_code},
@@ -197,9 +197,11 @@ class IndexifyClient:
197
197
  for item in namespaces_dict:
198
198
  namespaces.append(item["name"])
199
199
  return namespaces
200
-
200
+
201
201
  @classmethod
202
- def new_namespace(cls, namespace: str, server_addr: Optional[str] = "http://localhost:8900"):
202
+ def new_namespace(
203
+ cls, namespace: str, server_addr: Optional[str] = "http://localhost:8900"
204
+ ):
203
205
  # Create a new client instance with the specified server address
204
206
  client = cls(service_url=server_addr)
205
207
 
@@ -212,11 +214,10 @@ class IndexifyClient:
212
214
 
213
215
  # Set the namespace for the newly created client
214
216
  client.namespace = namespace
215
-
217
+
216
218
  # Return the client instance with the new namespace
217
219
  return client
218
220
 
219
-
220
221
  def create_namespace(self, namespace: str):
221
222
  self._post("namespaces", json={"name": namespace})
222
223
 
@@ -253,8 +254,16 @@ class IndexifyClient:
253
254
  for sse in event_source.iter_sse():
254
255
  obj = json.loads(sse.data)
255
256
  for k, v in obj.items():
257
+ if k == "id":
258
+ return v
256
259
  if k == "InvocationFinished":
257
260
  return v["id"]
261
+ if k == "DiagnosticMessage":
262
+ message = v.get("message", None)
263
+ print(
264
+ f"[bold red]scheduler diagnostic: [/bold red]{message}"
265
+ )
266
+ continue
258
267
  event_payload = InvocationEventPayload.model_validate(v)
259
268
  event = InvocationEvent(event_name=k, payload=event_payload)
260
269
  if (
@@ -32,7 +32,7 @@ class RemoteGraph:
32
32
  return self._client.invoke_graph_with_object(
33
33
  self._name, block_until_done, **kwargs
34
34
  )
35
-
35
+
36
36
  def rerun(self):
37
37
  """
38
38
  Rerun the graph with the given invocation ID.
@@ -41,17 +41,19 @@ class RemoteGraph:
41
41
  self._client.rerun_graph(self._name)
42
42
 
43
43
  @classmethod
44
- def deploy(cls, g: Graph, additional_modules=[], server_url: Optional[str] = "http://localhost:8900"):
44
+ def deploy(
45
+ cls,
46
+ g: Graph,
47
+ additional_modules=[],
48
+ server_url: Optional[str] = "http://localhost:8900",
49
+ ):
45
50
  """
46
51
  Create a new RemoteGraph from a local Graph object.
47
52
  :param g: The local Graph object.
48
53
  :param server_url: The URL of the server where the graph will be registered.
49
54
  """
50
- import cloudpickle
51
- for module in additional_modules:
52
- cloudpickle.register_pickle_by_value(module)
53
55
  client = IndexifyClient(service_url=server_url)
54
- client.register_compute_graph(g)
56
+ client.register_compute_graph(g, additional_modules)
55
57
  return cls(name=g.name, server_url=server_url)
56
58
 
57
59
  @classmethod
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "indexify"
3
- version = "0.2.9"
3
+ version = "0.2.11"
4
4
  description = "Python Client for Indexify"
5
5
  authors = ["Tensorlake Inc. <support@tensorlake.ai>"]
6
6
  license = "Apache 2.0"
File without changes
File without changes
File without changes
File without changes
File without changes