indexify 0.2.10__py3-none-any.whl → 0.2.11__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.
- indexify/cli.py +3 -1
- indexify/executor/function_worker.py +9 -2
- indexify/functions_sdk/graph.py +5 -2
- indexify/http_client.py +10 -7
- indexify/remote_graph.py +8 -6
- {indexify-0.2.10.dist-info → indexify-0.2.11.dist-info}/METADATA +1 -1
- {indexify-0.2.10.dist-info → indexify-0.2.11.dist-info}/RECORD +10 -10
- {indexify-0.2.10.dist-info → indexify-0.2.11.dist-info}/LICENSE.txt +0 -0
- {indexify-0.2.10.dist-info → indexify-0.2.11.dist-info}/WHEEL +0 -0
- {indexify-0.2.10.dist-info → indexify-0.2.11.dist-info}/entry_points.txt +0 -0
indexify/cli.py
CHANGED
@@ -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,
|
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(
|
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
|
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)
|
indexify/functions_sdk/graph.py
CHANGED
@@ -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
|
-
|
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(
|
indexify/http_client.py
CHANGED
@@ -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(
|
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
|
|
@@ -259,7 +260,9 @@ class IndexifyClient:
|
|
259
260
|
return v["id"]
|
260
261
|
if k == "DiagnosticMessage":
|
261
262
|
message = v.get("message", None)
|
262
|
-
print(
|
263
|
+
print(
|
264
|
+
f"[bold red]scheduler diagnostic: [/bold red]{message}"
|
265
|
+
)
|
263
266
|
continue
|
264
267
|
event_payload = InvocationEventPayload.model_validate(v)
|
265
268
|
event = InvocationEvent(event_name=k, payload=event_payload)
|
indexify/remote_graph.py
CHANGED
@@ -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(
|
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,5 +1,5 @@
|
|
1
1
|
indexify/__init__.py,sha256=qgMBKVrM_tI-tFeWpE8ktlC5rcExk05nbWyFqxxqeEU,496
|
2
|
-
indexify/cli.py,sha256=
|
2
|
+
indexify/cli.py,sha256=zSJ5dk5mqmRWkXX150v9ziGqPvFd8gmQDf77Gcc3ZYY,8391
|
3
3
|
indexify/data_loaders/__init__.py,sha256=Y5NEuseTcYAICRiweYw5wBQ2m2YplbsY21I7df-rdi4,1339
|
4
4
|
indexify/data_loaders/local_directory_loader.py,sha256=fCrgj5drnW71ZUdDDvcB1-VJjIs1w6Q8sEW0HSGSAiA,1247
|
5
5
|
indexify/data_loaders/url_loader.py,sha256=32SERljcq1Xsi4RdLz2dgyk2TER5pQPTtXl3gUzwHbY,1533
|
@@ -8,24 +8,24 @@ indexify/executor/agent.py,sha256=I08CiOWeJ_mz8OHr9_iJfp07Ma1VMQirZ2MsDp8lDZw,14
|
|
8
8
|
indexify/executor/api_objects.py,sha256=SysjlGYu4JtYdqfexZHHN1IW4TtaDdFUF3hYZ5mpUJU,810
|
9
9
|
indexify/executor/downloader.py,sha256=0MPiKw0AWs3Z7ReC9l2z-3515yqq85ghPzdh485dnuw,3998
|
10
10
|
indexify/executor/executor_tasks.py,sha256=gAZ2pvza1YwGlaR1o_tJW4SXtdCgK7sLJgp4W7rOjR0,1834
|
11
|
-
indexify/executor/function_worker.py,sha256=
|
11
|
+
indexify/executor/function_worker.py,sha256=RQh-lJD2UtUuYXyCDkGohe8rVpHEriJg-AjBKSgD5KI,5436
|
12
12
|
indexify/executor/indexify_executor.py,sha256=2Ut_VX-Su_lm4b4aEROyRJ3gXx-uFHA-V7EN0sWiARE,771
|
13
13
|
indexify/executor/runtime_probes.py,sha256=L-nB4D2zBZ287xxPwErv5R_gxFOmTEvg61FMe3rUB_A,1460
|
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=
|
17
|
+
indexify/functions_sdk/graph.py,sha256=t35z26jRCBgoz7fncdlAL7MVTOYjeJuoPpz-xI7WjBw,11827
|
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=RcFhVjmQv83S2wuf7Yn9RMhdpT-WfRqr1-krCF5UjNM,716
|
21
21
|
indexify/functions_sdk/indexify_functions.py,sha256=oUssAADTt3byhz3Azl_GiYxV1BmhwuGE1CjmN-oiBpg,9575
|
22
22
|
indexify/functions_sdk/local_cache.py,sha256=cNWF67zbhbTJe3g86hyLBy3Rqzs6dNvp2SjLazGZWvw,1348
|
23
23
|
indexify/functions_sdk/object_serializer.py,sha256=Zz4GobW3ZamBBtFDF76QxU3TP6oJNdWnhsfKd0OUFoc,1660
|
24
|
-
indexify/http_client.py,sha256=
|
25
|
-
indexify/remote_graph.py,sha256=
|
24
|
+
indexify/http_client.py,sha256=0nB-2yQPoVfvTRGvRru_pW6SWjqeT8jtXJPm-MC71pg,13636
|
25
|
+
indexify/remote_graph.py,sha256=ILg6IY6EFgyvnfz1DSzicBZhqvPkg2-UUwgI6lxp6sA,3094
|
26
26
|
indexify/settings.py,sha256=LSaWZ0ADIVmUv6o6dHWRC3-Ry5uLbCw2sBSg1e_U7UM,99
|
27
|
-
indexify-0.2.
|
28
|
-
indexify-0.2.
|
29
|
-
indexify-0.2.
|
30
|
-
indexify-0.2.
|
31
|
-
indexify-0.2.
|
27
|
+
indexify-0.2.11.dist-info/LICENSE.txt,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
28
|
+
indexify-0.2.11.dist-info/METADATA,sha256=FRk9YjzPFT37qHRdRiYOMS-SMvrDH51Fo8aIa_OW10E,6130
|
29
|
+
indexify-0.2.11.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
30
|
+
indexify-0.2.11.dist-info/entry_points.txt,sha256=Pih7WV-XMpAzI5dEvROcpLr-ybVhd9Y-AtuzBKUdcDs,49
|
31
|
+
indexify-0.2.11.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|