indexify 0.2.37__py3-none-any.whl → 0.2.39__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 +27 -14
- indexify/executor/agent.py +6 -1
- {indexify-0.2.37.dist-info → indexify-0.2.39.dist-info}/METADATA +2 -2
- {indexify-0.2.37.dist-info → indexify-0.2.39.dist-info}/RECORD +7 -8
- indexify/executor/image_dependency_installer.py +0 -64
- {indexify-0.2.37.dist-info → indexify-0.2.39.dist-info}/LICENSE.txt +0 -0
- {indexify-0.2.37.dist-info → indexify-0.2.39.dist-info}/WHEEL +0 -0
- {indexify-0.2.37.dist-info → indexify-0.2.39.dist-info}/entry_points.txt +0 -0
indexify/cli.py
CHANGED
@@ -6,9 +6,11 @@ import subprocess
|
|
6
6
|
import sys
|
7
7
|
import threading
|
8
8
|
import time
|
9
|
+
from importlib.metadata import version
|
9
10
|
from typing import Annotated, List, Optional
|
10
11
|
|
11
12
|
import nanoid
|
13
|
+
import structlog
|
12
14
|
import typer
|
13
15
|
from rich.console import Console
|
14
16
|
from rich.panel import Panel
|
@@ -32,6 +34,7 @@ custom_theme = Theme(
|
|
32
34
|
}
|
33
35
|
)
|
34
36
|
|
37
|
+
logging = structlog.get_logger(module=__name__)
|
35
38
|
console = Console(theme=custom_theme)
|
36
39
|
|
37
40
|
app = typer.Typer(pretty_exceptions_enable=False, no_args_is_help=True)
|
@@ -158,6 +161,9 @@ def build_default_image():
|
|
158
161
|
@app.command(help="Joins the extractors to the coordinator server")
|
159
162
|
def executor(
|
160
163
|
server_addr: str = "localhost:8900",
|
164
|
+
dev: Annotated[
|
165
|
+
bool, typer.Option("--dev", "-d", help="Run the executor in development mode")
|
166
|
+
] = False,
|
161
167
|
workers: Annotated[
|
162
168
|
int, typer.Option(help="number of worker processes for extraction")
|
163
169
|
] = 1,
|
@@ -174,19 +180,26 @@ def executor(
|
|
174
180
|
"1", help="Requested Image Version for this executor"
|
175
181
|
),
|
176
182
|
):
|
183
|
+
# configure structured logging
|
184
|
+
if not dev:
|
185
|
+
processors = [
|
186
|
+
structlog.processors.dict_tracebacks,
|
187
|
+
structlog.processors.JSONRenderer(),
|
188
|
+
]
|
189
|
+
structlog.configure(processors=processors)
|
190
|
+
|
177
191
|
id = nanoid.generate()
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
)
|
192
|
+
executor_version = version("indexify")
|
193
|
+
logging.info(
|
194
|
+
"executor started",
|
195
|
+
workers=workers,
|
196
|
+
server_addr=server_addr,
|
197
|
+
config_path=config_path,
|
198
|
+
executor_id=id,
|
199
|
+
executor_version=executor_version,
|
200
|
+
executor_cache=executor_cache,
|
201
|
+
name_alias=name_alias,
|
202
|
+
image_version=image_version,
|
190
203
|
)
|
191
204
|
|
192
205
|
from pathlib import Path
|
@@ -208,8 +221,8 @@ def executor(
|
|
208
221
|
|
209
222
|
try:
|
210
223
|
asyncio.get_event_loop().run_until_complete(agent.run())
|
211
|
-
except asyncio.CancelledError
|
212
|
-
|
224
|
+
except asyncio.CancelledError:
|
225
|
+
logging.info("graceful shutdown")
|
213
226
|
|
214
227
|
|
215
228
|
def _create_image(image: Image, python_sdk_path):
|
indexify/executor/agent.py
CHANGED
@@ -299,7 +299,12 @@ class ExtractorAgent:
|
|
299
299
|
image_version=image_version,
|
300
300
|
labels=runtime_probe.labels,
|
301
301
|
).model_dump()
|
302
|
-
logging.info(
|
302
|
+
logging.info(
|
303
|
+
"registering_executor",
|
304
|
+
executor_id=self._executor_id,
|
305
|
+
url=url,
|
306
|
+
executor_version=executor_version,
|
307
|
+
)
|
303
308
|
try:
|
304
309
|
async with get_httpx_client(self._config_path, True) as client:
|
305
310
|
async with aconnect_sse(
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: indexify
|
3
|
-
Version: 0.2.
|
3
|
+
Version: 0.2.39
|
4
4
|
Summary: Python Client for Indexify
|
5
5
|
Home-page: https://github.com/tensorlakeai/indexify
|
6
6
|
License: Apache 2.0
|
@@ -17,7 +17,7 @@ Classifier: Programming Language :: Python :: 3.13
|
|
17
17
|
Requires-Dist: cloudpickle (>=3.1.0,<4.0.0)
|
18
18
|
Requires-Dist: docker (>=7.1.0,<8.0.0)
|
19
19
|
Requires-Dist: httpx-sse (>=0.4.0,<0.5.0)
|
20
|
-
Requires-Dist: httpx[http2] (
|
20
|
+
Requires-Dist: httpx[http2] (==0.27.2)
|
21
21
|
Requires-Dist: nanoid (>=2.0.0,<3.0.0)
|
22
22
|
Requires-Dist: pydantic (==2.10.2)
|
23
23
|
Requires-Dist: pyyaml (>=6,<7)
|
@@ -1,16 +1,15 @@
|
|
1
1
|
indexify/__init__.py,sha256=P0mvM8sbkeS2CjYzRYyzb42CnXGhyJXdz4FdmTBMSWM,697
|
2
|
-
indexify/cli.py,sha256=
|
2
|
+
indexify/cli.py,sha256=QqaRpm-XywJQ3zh-2pgABi15Jl0IkwA_sz6PRNvQ4wc,8872
|
3
3
|
indexify/common_util.py,sha256=LKS6yZ3yv8nF2J-KzisGIjqjTvCn7tLFifQJLT4gHRg,3529
|
4
4
|
indexify/data_loaders/__init__.py,sha256=Y5NEuseTcYAICRiweYw5wBQ2m2YplbsY21I7df-rdi4,1339
|
5
5
|
indexify/data_loaders/local_directory_loader.py,sha256=fCrgj5drnW71ZUdDDvcB1-VJjIs1w6Q8sEW0HSGSAiA,1247
|
6
6
|
indexify/data_loaders/url_loader.py,sha256=32SERljcq1Xsi4RdLz2dgyk2TER5pQPTtXl3gUzwHbY,1533
|
7
7
|
indexify/error.py,sha256=qAWr8R6AxPkjsxHSzXTc8zqYnNO_AjOqqYEPsQvF1Zs,238
|
8
|
-
indexify/executor/agent.py,sha256=
|
8
|
+
indexify/executor/agent.py,sha256=6xcGDZLwFHlFDiqW9EOI_Dfxh8ahdhGZq4PZUoyPLEY,14167
|
9
9
|
indexify/executor/api_objects.py,sha256=mvmwGbK4paJNQGFvbtNHMPpiH_LpVhrlRnCcrqS6HOQ,859
|
10
10
|
indexify/executor/downloader.py,sha256=dHLxoBnX8-Bh4yZtFDYptZNF6rlVtmTk_70JK8Ect5w,4184
|
11
11
|
indexify/executor/executor_tasks.py,sha256=A0UIEZ5VaB6zSkFQG81UmTW0E57MTYhGlaXuAbRV8lQ,1884
|
12
12
|
indexify/executor/function_worker.py,sha256=wRW2-X9dNI80KhwTD1vD-pcyetsVKVs6vVdg7L7JjcQ,6462
|
13
|
-
indexify/executor/image_dependency_installer.py,sha256=ct8GmzgkaPi6NAblk68IJJWo5MecIUubELotmSrgoRQ,1759
|
14
13
|
indexify/executor/indexify_executor.py,sha256=2Ut_VX-Su_lm4b4aEROyRJ3gXx-uFHA-V7EN0sWiARE,771
|
15
14
|
indexify/executor/runtime_probes.py,sha256=mjw2_mGQ622wRT_39WPGGgPEZQTgtrf3-ICcUUZOeyg,2126
|
16
15
|
indexify/executor/task_reporter.py,sha256=XlEhNf_ScNnzG67zbtVwL7_9Bo8MvPZiHLI5UHymUnM,5305
|
@@ -28,8 +27,8 @@ indexify/http_client.py,sha256=iLafZagCFnlTS6uHfOjInogjg0uXW_zXEspIN7ttB5I,15903
|
|
28
27
|
indexify/remote_graph.py,sha256=OzBucU4buR5UdTViNJvh1RfnOTmYA34Uel5qXnRsQsA,5006
|
29
28
|
indexify/remote_pipeline.py,sha256=oqx57rSPszNS3DToXO_nf-CKqkCZWptm1u_p3orV_gQ,790
|
30
29
|
indexify/settings.py,sha256=Ny59mzYI4gbXoK8hjx66a_men6ndbd1J1zCTcKOoyzg,50
|
31
|
-
indexify-0.2.
|
32
|
-
indexify-0.2.
|
33
|
-
indexify-0.2.
|
34
|
-
indexify-0.2.
|
35
|
-
indexify-0.2.
|
30
|
+
indexify-0.2.39.dist-info/LICENSE.txt,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
31
|
+
indexify-0.2.39.dist-info/METADATA,sha256=3a5sh2AM-myayTJRnpPZxPtrKTDkXggJ7SXaCUyharw,6199
|
32
|
+
indexify-0.2.39.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
33
|
+
indexify-0.2.39.dist-info/entry_points.txt,sha256=Pih7WV-XMpAzI5dEvROcpLr-ybVhd9Y-AtuzBKUdcDs,49
|
34
|
+
indexify-0.2.39.dist-info/RECORD,,
|
@@ -1,64 +0,0 @@
|
|
1
|
-
import os
|
2
|
-
import subprocess
|
3
|
-
|
4
|
-
from rich.console import Console
|
5
|
-
from rich.text import Text
|
6
|
-
from rich.theme import Theme
|
7
|
-
|
8
|
-
from indexify.functions_sdk.image import ImageInformation
|
9
|
-
|
10
|
-
custom_theme = Theme(
|
11
|
-
{
|
12
|
-
"info": "cyan",
|
13
|
-
"warning": "yellow",
|
14
|
-
"error": "red",
|
15
|
-
"success": "green",
|
16
|
-
}
|
17
|
-
)
|
18
|
-
|
19
|
-
console = Console(theme=custom_theme)
|
20
|
-
|
21
|
-
|
22
|
-
def _record_image_name(name: str, version: int):
|
23
|
-
dir_path = os.path.expanduser("~/.indexify/")
|
24
|
-
|
25
|
-
file_path = os.path.expanduser("~/.indexify/image_name")
|
26
|
-
os.makedirs(dir_path, exist_ok=True)
|
27
|
-
with open(file_path, "w") as file:
|
28
|
-
file.write(name)
|
29
|
-
|
30
|
-
file_path = os.path.expanduser("~/.indexify/image_version")
|
31
|
-
os.makedirs(dir_path, exist_ok=True)
|
32
|
-
with open(file_path, "w") as file:
|
33
|
-
file.write(str(version))
|
34
|
-
|
35
|
-
|
36
|
-
def _install_dependencies(run_str: str):
|
37
|
-
# Throw error to the caller if these subprocesses fail.
|
38
|
-
proc = subprocess.run(run_str.split())
|
39
|
-
if proc.returncode != 0:
|
40
|
-
raise Exception(f"Unable to install dep `{run_str}`")
|
41
|
-
|
42
|
-
|
43
|
-
def executor_image_builder(
|
44
|
-
image_info: ImageInformation, name_alias: str, image_version: int
|
45
|
-
):
|
46
|
-
console.print(Text("Attempting Executor Bootstrap.", style="red bold"))
|
47
|
-
|
48
|
-
run_strs = image_info.run_strs
|
49
|
-
console.print(Text("Attempting to install dependencies.", style="red bold"))
|
50
|
-
|
51
|
-
for run_str in run_strs:
|
52
|
-
console.print(Text(f"Attempting {run_str}", style="red bold"))
|
53
|
-
_install_dependencies(run_str)
|
54
|
-
|
55
|
-
console.print(Text("Install dependencies done.", style="red bold"))
|
56
|
-
|
57
|
-
console.print(
|
58
|
-
Text(
|
59
|
-
f"Recording image name {name_alias} and version {image_version}",
|
60
|
-
style="red bold",
|
61
|
-
)
|
62
|
-
)
|
63
|
-
|
64
|
-
_record_image_name(name_alias, image_version)
|
File without changes
|
File without changes
|
File without changes
|