indexify 0.3.30__py3-none-any.whl → 0.4.2__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.
Files changed (74) hide show
  1. indexify/cli/__init__.py +18 -0
  2. indexify/cli/build_image.py +51 -0
  3. indexify/cli/deploy.py +57 -0
  4. indexify/cli/executor.py +205 -0
  5. indexify/executor/{grpc/channel_manager.py → channel_manager.py} +17 -11
  6. indexify/executor/executor.py +57 -311
  7. indexify/executor/function_allowlist.py +59 -0
  8. indexify/executor/function_executor/function_executor.py +12 -6
  9. indexify/executor/function_executor/invocation_state_client.py +25 -3
  10. indexify/executor/function_executor/server/function_executor_server_factory.py +3 -3
  11. indexify/executor/function_executor/server/subprocess_function_executor_server_factory.py +22 -11
  12. indexify/executor/function_executor_controller/__init__.py +13 -0
  13. indexify/executor/function_executor_controller/completed_task_metrics.py +82 -0
  14. indexify/executor/function_executor_controller/create_function_executor.py +154 -0
  15. indexify/executor/function_executor_controller/debug_event_loop.py +37 -0
  16. indexify/executor/function_executor_controller/destroy_function_executor.py +28 -0
  17. indexify/executor/function_executor_controller/downloads.py +199 -0
  18. indexify/executor/function_executor_controller/events.py +172 -0
  19. indexify/executor/function_executor_controller/function_executor_controller.py +759 -0
  20. indexify/executor/function_executor_controller/loggers.py +57 -0
  21. indexify/executor/function_executor_controller/message_validators.py +65 -0
  22. indexify/executor/function_executor_controller/metrics/completed_task_metrics.py +68 -0
  23. indexify/executor/{metrics/downloader.py → function_executor_controller/metrics/downloads.py} +1 -3
  24. indexify/executor/function_executor_controller/metrics/function_executor_controller.py +60 -0
  25. indexify/executor/{function_executor/metrics/single_task_runner.py → function_executor_controller/metrics/run_task.py} +9 -3
  26. indexify/executor/function_executor_controller/metrics/upload_task_output.py +39 -0
  27. indexify/executor/function_executor_controller/prepare_task.py +38 -0
  28. indexify/executor/function_executor_controller/run_task.py +201 -0
  29. indexify/executor/function_executor_controller/task_info.py +33 -0
  30. indexify/executor/function_executor_controller/task_output.py +122 -0
  31. indexify/executor/function_executor_controller/upload_task_output.py +234 -0
  32. indexify/executor/host_resources/host_resources.py +20 -25
  33. indexify/executor/{grpc/metrics → metrics}/channel_manager.py +1 -1
  34. indexify/executor/metrics/executor.py +0 -47
  35. indexify/executor/{grpc/metrics → metrics}/state_reconciler.py +1 -1
  36. indexify/executor/{grpc/metrics → metrics}/state_reporter.py +1 -1
  37. indexify/executor/monitoring/health_checker/generic_health_checker.py +6 -59
  38. indexify/executor/monitoring/health_checker/health_checker.py +0 -11
  39. indexify/executor/{grpc/state_reconciler.py → state_reconciler.py} +139 -141
  40. indexify/executor/state_reporter.py +364 -0
  41. indexify/proto/executor_api.proto +67 -59
  42. indexify/proto/executor_api_pb2.py +52 -52
  43. indexify/proto/executor_api_pb2.pyi +125 -104
  44. indexify/proto/executor_api_pb2_grpc.py +0 -47
  45. {indexify-0.3.30.dist-info → indexify-0.4.2.dist-info}/METADATA +1 -3
  46. indexify-0.4.2.dist-info/RECORD +68 -0
  47. indexify-0.4.2.dist-info/entry_points.txt +3 -0
  48. indexify/cli/cli.py +0 -267
  49. indexify/executor/api_objects.py +0 -92
  50. indexify/executor/downloader.py +0 -417
  51. indexify/executor/executor_flavor.py +0 -7
  52. indexify/executor/function_executor/function_executor_state.py +0 -107
  53. indexify/executor/function_executor/function_executor_states_container.py +0 -93
  54. indexify/executor/function_executor/function_executor_status.py +0 -95
  55. indexify/executor/function_executor/metrics/function_executor_state.py +0 -46
  56. indexify/executor/function_executor/metrics/function_executor_state_container.py +0 -10
  57. indexify/executor/function_executor/single_task_runner.py +0 -345
  58. indexify/executor/function_executor/task_input.py +0 -21
  59. indexify/executor/function_executor/task_output.py +0 -105
  60. indexify/executor/grpc/function_executor_controller.py +0 -418
  61. indexify/executor/grpc/metrics/task_controller.py +0 -8
  62. indexify/executor/grpc/state_reporter.py +0 -314
  63. indexify/executor/grpc/task_controller.py +0 -508
  64. indexify/executor/metrics/task_fetcher.py +0 -21
  65. indexify/executor/metrics/task_reporter.py +0 -53
  66. indexify/executor/metrics/task_runner.py +0 -52
  67. indexify/executor/monitoring/function_allowlist.py +0 -25
  68. indexify/executor/runtime_probes.py +0 -68
  69. indexify/executor/task_fetcher.py +0 -96
  70. indexify/executor/task_reporter.py +0 -459
  71. indexify/executor/task_runner.py +0 -177
  72. indexify-0.3.30.dist-info/RECORD +0 -68
  73. indexify-0.3.30.dist-info/entry_points.txt +0 -3
  74. {indexify-0.3.30.dist-info → indexify-0.4.2.dist-info}/WHEEL +0 -0
@@ -56,12 +56,6 @@ class ExecutorAPIStub(object):
56
56
  response_deserializer=indexify_dot_proto_dot_executor__api__pb2.DesiredExecutorState.FromString,
57
57
  _registered_method=True,
58
58
  )
59
- self.report_task_outcome = channel.unary_unary(
60
- "/executor_api_pb.ExecutorAPI/report_task_outcome",
61
- request_serializer=indexify_dot_proto_dot_executor__api__pb2.ReportTaskOutcomeRequest.SerializeToString,
62
- response_deserializer=indexify_dot_proto_dot_executor__api__pb2.ReportTaskOutcomeResponse.FromString,
63
- _registered_method=True,
64
- )
65
59
 
66
60
 
67
61
  class ExecutorAPIServicer(object):
@@ -92,12 +86,6 @@ class ExecutorAPIServicer(object):
92
86
  context.set_details("Method not implemented!")
93
87
  raise NotImplementedError("Method not implemented!")
94
88
 
95
- def report_task_outcome(self, request, context):
96
- """Report the outcome of a task."""
97
- context.set_code(grpc.StatusCode.UNIMPLEMENTED)
98
- context.set_details("Method not implemented!")
99
- raise NotImplementedError("Method not implemented!")
100
-
101
89
 
102
90
  def add_ExecutorAPIServicer_to_server(servicer, server):
103
91
  rpc_method_handlers = {
@@ -111,11 +99,6 @@ def add_ExecutorAPIServicer_to_server(servicer, server):
111
99
  request_deserializer=indexify_dot_proto_dot_executor__api__pb2.GetDesiredExecutorStatesRequest.FromString,
112
100
  response_serializer=indexify_dot_proto_dot_executor__api__pb2.DesiredExecutorState.SerializeToString,
113
101
  ),
114
- "report_task_outcome": grpc.unary_unary_rpc_method_handler(
115
- servicer.report_task_outcome,
116
- request_deserializer=indexify_dot_proto_dot_executor__api__pb2.ReportTaskOutcomeRequest.FromString,
117
- response_serializer=indexify_dot_proto_dot_executor__api__pb2.ReportTaskOutcomeResponse.SerializeToString,
118
- ),
119
102
  }
120
103
  generic_handler = grpc.method_handlers_generic_handler(
121
104
  "executor_api_pb.ExecutorAPI", rpc_method_handlers
@@ -195,33 +178,3 @@ class ExecutorAPI(object):
195
178
  metadata,
196
179
  _registered_method=True,
197
180
  )
198
-
199
- @staticmethod
200
- def report_task_outcome(
201
- request,
202
- target,
203
- options=(),
204
- channel_credentials=None,
205
- call_credentials=None,
206
- insecure=False,
207
- compression=None,
208
- wait_for_ready=None,
209
- timeout=None,
210
- metadata=None,
211
- ):
212
- return grpc.experimental.unary_unary(
213
- request,
214
- target,
215
- "/executor_api_pb.ExecutorAPI/report_task_outcome",
216
- indexify_dot_proto_dot_executor__api__pb2.ReportTaskOutcomeRequest.SerializeToString,
217
- indexify_dot_proto_dot_executor__api__pb2.ReportTaskOutcomeResponse.FromString,
218
- options,
219
- channel_credentials,
220
- insecure,
221
- call_credentials,
222
- compression,
223
- wait_for_ready,
224
- timeout,
225
- metadata,
226
- _registered_method=True,
227
- )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: indexify
3
- Version: 0.3.30
3
+ Version: 0.4.2
4
4
  Summary: Open Source Indexify components and helper tools
5
5
  Home-page: https://github.com/tensorlakeai/indexify
6
6
  License: Apache 2.0
@@ -18,9 +18,7 @@ Requires-Dist: aiohttp (>=3.11.0,<4.0.0)
18
18
  Requires-Dist: boto3 (>=1.37.30,<2.0.0)
19
19
  Requires-Dist: prometheus-client (>=0.21.1,<0.22.0)
20
20
  Requires-Dist: psutil (>=7.0.0,<8.0.0)
21
- Requires-Dist: rich (>=13.9.2,<14.0.0)
22
21
  Requires-Dist: tensorlake (>=0.1)
23
- Requires-Dist: typer (>=0.12,<0.13)
24
22
  Project-URL: Repository, https://github.com/tensorlakeai/indexify
25
23
  Description-Content-Type: text/markdown
26
24
 
@@ -0,0 +1,68 @@
1
+ indexify/cli/__init__.py,sha256=ELFLx_Z_oWm30jwOpYjbD6Ori3Nzz4ldkvmGVK7QMgw,426
2
+ indexify/cli/build_image.py,sha256=HG-80EXc-lCYYjU67iDnR9W8hqpDYsldE-rTW6klbRo,1601
3
+ indexify/cli/deploy.py,sha256=YM5NB1B5WDalN4Hx-EC5NL30p3UBenrctMv6kPSbd94,1833
4
+ indexify/cli/executor.py,sha256=UgKPQaObIJVFht0niLEsw8y4k8XBF3siWpTig2_nV8U,6584
5
+ indexify/executor/README.md,sha256=ozC6_hMkhQQNVCMEpBxwiUALz6lwErPQxNxQfQDqnG4,2029
6
+ indexify/executor/blob_store/blob_store.py,sha256=XViw_KRfFSNqwcFYwMZixZF-EYCjXK2AQHdt0xh4UVo,2368
7
+ indexify/executor/blob_store/local_fs_blob_store.py,sha256=6LexqMBGXp8f6Ka95R6xMIUyDutrZJABOMNcp-ssa98,1809
8
+ indexify/executor/blob_store/metrics/blob_store.py,sha256=5_xiPREeHWFtxFh1NupDsF8zP4pmUPgLNNn-UE9Uzvc,1008
9
+ indexify/executor/blob_store/s3_blob_store.py,sha256=G3B_V3gUE7XbUY42lDtBczUKuA7q8S7MD43tx1aHrJo,3445
10
+ indexify/executor/channel_manager.py,sha256=MXHY2QkoSqEwUAb_EAUrbScPIWOgSPIvD8EL7EWBrK0,6502
11
+ indexify/executor/executor.py,sha256=AGtOHbznjGLQMjJHie10gxq1fLq3h23uXvk4tVkxxEw,6294
12
+ indexify/executor/function_allowlist.py,sha256=PCelCW6qIe_2sH11BCKr7LDqarRV5kwNsrfB2EV7Zwo,1772
13
+ indexify/executor/function_executor/function_executor.py,sha256=cnixOPaKNSLCBpe6LzJ_IrwPcYAlG3AP_GW48xik8Gc,12005
14
+ indexify/executor/function_executor/health_checker.py,sha256=IxE0jnC99K_lvnizFLjXqS1942H8-FNAN4AlhLIjg2Y,6373
15
+ indexify/executor/function_executor/invocation_state_client.py,sha256=tARfeEEOZJoWd38wA5e7ihKMbR3llk90eD_KQ1QD6cs,10582
16
+ indexify/executor/function_executor/metrics/function_executor.py,sha256=TDksxLRJr-P9ZKhF2Orsaxzzb4lVIBxFEjd_9Zv53Ng,6313
17
+ indexify/executor/function_executor/metrics/health_checker.py,sha256=EaeIYJPrQ-qqNMGZVGkvjPoeQSCl4FzPKXEv3Cly1NE,456
18
+ indexify/executor/function_executor/metrics/invocation_state_client.py,sha256=6FCW6rXHVZZSmwLquZdpjgQPSmE_99naDLke5rZiwMI,1867
19
+ indexify/executor/function_executor/server/client_configuration.py,sha256=gOywMus0cotlX6NKIadEJwvOmBE-LbGE_wvoMi5-HzY,994
20
+ indexify/executor/function_executor/server/function_executor_server.py,sha256=_DLivLDikupZusRk8gVWDk7fWPT9XjZ4un1yWSlOObs,883
21
+ indexify/executor/function_executor/server/function_executor_server_factory.py,sha256=tAyBDNq6UXmHM4PUXqBkXCSGer6MgMaV1_zoruHPJVg,1843
22
+ indexify/executor/function_executor/server/subprocess_function_executor_server.py,sha256=JekDOqF7oFD4J6zcN3xB0Dxd1cgpEXMOsb_rKZOeBlI,668
23
+ indexify/executor/function_executor/server/subprocess_function_executor_server_factory.py,sha256=w5aGQPHWLpixlP9-BbZu6oL_muMA95-hr7WKVxiEL7Q,4303
24
+ indexify/executor/function_executor_controller/__init__.py,sha256=aGHUlSLp7RmRN_u5GYb248TCVMOM3OVeS8GA99zlQX0,435
25
+ indexify/executor/function_executor_controller/completed_task_metrics.py,sha256=_awcdfAd04YjddV-X1W5_2o-odwuu4BTuH1E0QHjgzI,3596
26
+ indexify/executor/function_executor_controller/create_function_executor.py,sha256=ndZLgbXzPHn2QKJKw-TJUqCURTB22J8vTIOVY0gYJaA,5996
27
+ indexify/executor/function_executor_controller/debug_event_loop.py,sha256=VJOKe_c9HjIDVCjhMY3Yqyeq1tAM1eVa2chZa6CMf-U,1016
28
+ indexify/executor/function_executor_controller/destroy_function_executor.py,sha256=FRyfY82SE1gRYaK85Gz0I05vhlpJrze6po8Hh7bOQuc,826
29
+ indexify/executor/function_executor_controller/downloads.py,sha256=iVXuDl9mUOOMurpd6wrtIexUHubgvM9GdKxwgwQA44E,6487
30
+ indexify/executor/function_executor_controller/events.py,sha256=uz16nlGdkorpy_r4g8K9sSVinuemQ7EWpW_8F36ueAc,5685
31
+ indexify/executor/function_executor_controller/function_executor_controller.py,sha256=MnwjaEXFELoPKuSJ2II3e1RjQ6MrULLMkektbGiev68,32065
32
+ indexify/executor/function_executor_controller/loggers.py,sha256=_KFbAo_CPflaBfPuGBJbhLYK6GacLhBROuxJZ9PdY5U,1967
33
+ indexify/executor/function_executor_controller/message_validators.py,sha256=mMuP93Ul-2P35X7CqwEBZt1fnoXeVwPtAiQdADqMvC0,2223
34
+ indexify/executor/function_executor_controller/metrics/completed_task_metrics.py,sha256=53EGBCLwCEV-RBBeyLPTElrtcveaEM0Fwxs9NmC1Hn8,2724
35
+ indexify/executor/function_executor_controller/metrics/downloads.py,sha256=KOVTE2OZPCewnCooPyCK1maKe9ddMPvBFp7D_igqugQ,2708
36
+ indexify/executor/function_executor_controller/metrics/function_executor_controller.py,sha256=KjUrvsUE9wSW8H0YNYI0BGMftGL10aplYVv_tAr11h4,2322
37
+ indexify/executor/function_executor_controller/metrics/run_task.py,sha256=kdjw-Bi788B8Pq4eL08k8HVtcjIA3y8pLLSNWRBI8YA,1006
38
+ indexify/executor/function_executor_controller/metrics/upload_task_output.py,sha256=Ppf8NujCNbQzFelJiuh8Sutcjty7hnkFz1dWQLYIgQI,1464
39
+ indexify/executor/function_executor_controller/prepare_task.py,sha256=_oorkGMbsbVU_-fpk1n3m6aFcIEnuveqYc0iKJlkUOk,1214
40
+ indexify/executor/function_executor_controller/run_task.py,sha256=fNtoDKkP5PV4F-abAYs0Ey9WzhHHGbzdCRGU5VWsns0,7866
41
+ indexify/executor/function_executor_controller/task_info.py,sha256=JVhGjYqOVQ0pEQqJCz84SyRBM3zD-qdCAJUSJqMTovc,1178
42
+ indexify/executor/function_executor_controller/task_output.py,sha256=bnjaUJXp8_yt62u1ij97SJSlBE9KDwgZ1VZJ-tse6eE,4192
43
+ indexify/executor/function_executor_controller/upload_task_output.py,sha256=-UJAimxtyHtfO1QypixkCks-MJkzs82CSz0KgMfyqsM,8252
44
+ indexify/executor/host_resources/host_resources.py,sha256=ZSfox24jaz1IIaQWUmciOoev0l35rk8LHbnb_koJWno,3810
45
+ indexify/executor/host_resources/nvidia_gpu.py,sha256=BIxBcWenyhZe0fuPQT9I0g6zAWMDPcm_oZEfgOoYsFU,3306
46
+ indexify/executor/host_resources/nvidia_gpu_allocator.py,sha256=oULSjL0AVo_nqR_pquq17079UalHQkhMwMqf72gbPHo,1872
47
+ indexify/executor/metrics/channel_manager.py,sha256=1dU9bzF3xqBy1nY9Sc66GfQQWnWZSNip4lEH1vjoWdI,648
48
+ indexify/executor/metrics/executor.py,sha256=8dJXmyGqKlBSrPuyWXW7O2I21uxQ687l-2dYTvz4fmk,398
49
+ indexify/executor/metrics/state_reconciler.py,sha256=BSlRgvgtwih6QcYrsFU5P2ylaXAsC_X70DbzDuv9NsU,584
50
+ indexify/executor/metrics/state_reporter.py,sha256=_dssgz335UyZ67OoKNyI50gn4kzPZyFN4VpFGMNw4qE,542
51
+ indexify/executor/monitoring/handler.py,sha256=Cj1cu_LcsAP0tdviqNhoEtGm4h0OJAxxzW9C2YdNXYU,240
52
+ indexify/executor/monitoring/health_check_handler.py,sha256=e1pEtWFKaVs6H57Z4YLejNECrJtC38PweZc7xTJeqVw,695
53
+ indexify/executor/monitoring/health_checker/generic_health_checker.py,sha256=NQ1NTcaOJKd7xL9IaAtA8-VW4PZWIpW6N97MtTxmWVc,655
54
+ indexify/executor/monitoring/health_checker/health_checker.py,sha256=SiWJ_bKNLsxHCzwBMjS-DnFmXmN8CuPA61aTvv_iyTI,429
55
+ indexify/executor/monitoring/metrics.py,sha256=Dx2wPcTKvbd5Y5rGOfeyscFtAQ2DZ16_s5BX6d4nhI8,6660
56
+ indexify/executor/monitoring/prometheus_metrics_handler.py,sha256=KiGqSf7rkXTfbDwThyXFpFe2jnuZD5q-5SBP_0GDo8Y,591
57
+ indexify/executor/monitoring/server.py,sha256=yzdYhcxnmY6uTQUMt3vatF5jilN52ZtfFseOmHyQpTo,1254
58
+ indexify/executor/monitoring/startup_probe_handler.py,sha256=zXXsBU15SMlBx1bSFpxWDfed1VHtKKnwvLQ8-frpG98,425
59
+ indexify/executor/state_reconciler.py,sha256=Go0B2k1iq0iZiZTIjRkG2sfeILj_vTNpc8W2o0sBIDA,19179
60
+ indexify/executor/state_reporter.py,sha256=OxtIEa79lsZe5HzENHJPCYB4zESPw2zkNlGpKtKeOak,14629
61
+ indexify/proto/executor_api.proto,sha256=rpA8rLRdCcEQSb2BGSZS_blkcCpDzsEEQpMQFte-W3o,10858
62
+ indexify/proto/executor_api_pb2.py,sha256=1NeWZ4SniqmLO4-00HYy3h8ltAcm0FmdLnYr_O38RZM,15096
63
+ indexify/proto/executor_api_pb2.pyi,sha256=ufK8UmqhjvGxTb4KWSrwesEnco_YZG_WLTfoEvR9BoI,21121
64
+ indexify/proto/executor_api_pb2_grpc.py,sha256=i8LEPG6esub6C-xxJ7S3vEJSgWCOxSqElNjMW3Imqg8,7607
65
+ indexify-0.4.2.dist-info/METADATA,sha256=-kvduPjMeLAhrabmuIBHTdzMeNtdPQF03lyvC3U6Ab4,1161
66
+ indexify-0.4.2.dist-info/WHEEL,sha256=RaoafKOydTQ7I_I3JTrPCg6kUmTgtm4BornzOqyEfJ8,88
67
+ indexify-0.4.2.dist-info/entry_points.txt,sha256=rMJqbE5KPZIXTPIfAtVIM4zpUElqYVgEYd6i7N23zzg,49
68
+ indexify-0.4.2.dist-info/RECORD,,
@@ -0,0 +1,3 @@
1
+ [console_scripts]
2
+ indexify-cli=indexify.cli:cli
3
+
indexify/cli/cli.py DELETED
@@ -1,267 +0,0 @@
1
- from tensorlake.utils.logging import (
2
- configure_development_mode_logging,
3
- configure_logging_early,
4
- configure_production_mode_logging,
5
- )
6
-
7
- configure_logging_early()
8
-
9
- import os
10
- import shutil
11
- import sys
12
- from importlib.metadata import version
13
- from pathlib import Path
14
- from socket import gethostname
15
- from typing import Annotated, Dict, List, Optional, Tuple
16
-
17
- import nanoid
18
- import prometheus_client
19
- import structlog
20
- import typer
21
- from rich.console import Console
22
- from rich.text import Text
23
- from rich.theme import Theme
24
- from tensorlake.functions_sdk.image import Image
25
-
26
- from indexify.executor.api_objects import FunctionURI
27
- from indexify.executor.blob_store.blob_store import BLOBStore
28
- from indexify.executor.blob_store.local_fs_blob_store import LocalFSBLOBStore
29
- from indexify.executor.blob_store.s3_blob_store import S3BLOBStore
30
- from indexify.executor.executor import Executor
31
- from indexify.executor.executor_flavor import ExecutorFlavor
32
- from indexify.executor.function_executor.server.subprocess_function_executor_server_factory import (
33
- SubprocessFunctionExecutorServerFactory,
34
- )
35
- from indexify.executor.host_resources.host_resources import HostResourcesProvider
36
- from indexify.executor.host_resources.nvidia_gpu_allocator import NvidiaGPUAllocator
37
- from indexify.executor.monitoring.health_checker.generic_health_checker import (
38
- GenericHealthChecker,
39
- )
40
-
41
- custom_theme = Theme(
42
- {
43
- "info": "cyan",
44
- "warning": "yellow",
45
- "error": "red",
46
- "highlight": "magenta",
47
- }
48
- )
49
-
50
- console = Console(theme=custom_theme)
51
-
52
- app = typer.Typer(pretty_exceptions_enable=False, no_args_is_help=True)
53
-
54
-
55
- @app.command(help="Build image for function names")
56
- def build_image(
57
- workflow_file_path: str,
58
- image_names: Optional[List[str]] = None,
59
- python_sdk_path: Optional[str] = None,
60
- ):
61
- globals_dict = {}
62
-
63
- # Add the folder in the workflow file path to the current Python path
64
- folder_path = os.path.dirname(workflow_file_path)
65
- if folder_path not in sys.path:
66
- sys.path.append(folder_path)
67
-
68
- try:
69
- exec(open(workflow_file_path).read(), globals_dict)
70
- except FileNotFoundError as e:
71
- raise Exception(
72
- f"Could not find workflow file to execute at: `{workflow_file_path}`"
73
- )
74
- for _, obj in globals_dict.items():
75
- if type(obj) and isinstance(obj, Image):
76
- if image_names is None or obj._image_name in image_names:
77
- _create_image(obj, python_sdk_path)
78
-
79
-
80
- @app.command(
81
- context_settings={"allow_extra_args": True, "ignore_unknown_options": True},
82
- help="Runs Executor that connects to the Indexify server and starts running its tasks",
83
- )
84
- def executor(
85
- ctx: typer.Context,
86
- server_addr: str = "localhost:8900",
87
- grpc_server_addr: str = "localhost:8901",
88
- verbose_logs: Annotated[
89
- bool, typer.Option("--verbose", "-v", help="Run the executor in verbose mode")
90
- ] = False,
91
- function_uris: Annotated[
92
- Optional[List[str]],
93
- typer.Option(
94
- "--function",
95
- "-f",
96
- help="Function that the executor will run "
97
- "specified as <namespace>:<workflow>:<function>:<version>"
98
- "version is optional, not specifying it will make the server send any version"
99
- "of the function",
100
- ),
101
- ] = None,
102
- config_path: Optional[str] = typer.Option(
103
- None, help="Path to the TLS configuration file"
104
- ),
105
- executor_cache: Optional[str] = typer.Option(
106
- "~/.indexify/executor_cache", help="Path to the executor cache directory"
107
- ),
108
- monitoring_server_host: Annotated[
109
- str,
110
- typer.Option(
111
- "--monitoring-server-host",
112
- help="IP address or hostname where to run Executor Monitoring server",
113
- ),
114
- ] = "localhost",
115
- monitoring_server_port: Annotated[
116
- int,
117
- typer.Option(
118
- "--monitoring-server-port",
119
- help="Port where to run Executor Monitoring server",
120
- ),
121
- ] = 7000,
122
- labels: Annotated[
123
- List[str],
124
- typer.Option(
125
- "--label",
126
- "-l",
127
- help="Executor key-value label to be sent to the Server. "
128
- "Specified as <key>=<value>",
129
- ),
130
- ] = [],
131
- enable_grpc_state_reconciler: Annotated[
132
- bool,
133
- typer.Option(
134
- "--enable-grpc-state-reconciler",
135
- help=(
136
- "(exprimental) Enable gRPC state reconciler that will reconcile the state of the Function Executors and Task Allocations\n"
137
- "with the desired state provided by Server. Required --grpc-server-addr to be set."
138
- ),
139
- ),
140
- ] = False,
141
- ):
142
- if verbose_logs:
143
- compact_tracebacks: bool = os.getenv("INDEXIFY_COMPACT_TRACEBACKS", "1") == "1"
144
- configure_development_mode_logging(compact_tracebacks=compact_tracebacks)
145
- else:
146
- configure_production_mode_logging()
147
-
148
- kv_labels: Dict[str, str] = {}
149
- for label in labels:
150
- key, value = label.split("=")
151
- kv_labels[key] = value
152
-
153
- executor_id: str = nanoid.generate()
154
- executor_version = version("indexify")
155
- logger = structlog.get_logger(module=__name__, executor_id=executor_id)
156
-
157
- logger.info(
158
- "starting executor",
159
- hostname=gethostname(),
160
- server_addr=server_addr,
161
- grpc_server_addr=grpc_server_addr,
162
- config_path=config_path,
163
- executor_version=executor_version,
164
- labels=kv_labels,
165
- executor_cache=executor_cache,
166
- functions=function_uris,
167
- verbose_logs=verbose_logs,
168
- monitoring_server_host=monitoring_server_host,
169
- monitoring_server_port=monitoring_server_port,
170
- enable_grpc_state_reconciler=enable_grpc_state_reconciler,
171
- )
172
- if ctx.args:
173
- logger.warning(
174
- "Unknown arguments passed to the executor",
175
- unknown_args=ctx.args,
176
- )
177
-
178
- executor_cache = Path(executor_cache).expanduser().absolute()
179
- if os.path.exists(executor_cache):
180
- shutil.rmtree(executor_cache)
181
- Path(executor_cache).mkdir(parents=True, exist_ok=True)
182
-
183
- blob_store: BLOBStore = BLOBStore(
184
- # Local FS mode is used in tests and in cases when user wants to store data on NFS.
185
- local=LocalFSBLOBStore(),
186
- # S3 is initiliazed lazily so it's okay to create it even if the user is not going to use it.
187
- s3=S3BLOBStore(),
188
- )
189
-
190
- host_resources_provider: HostResourcesProvider = HostResourcesProvider(
191
- gpu_allocator=NvidiaGPUAllocator(logger),
192
- # Assuming a simple setup in OSS where Executor container has a single file system
193
- # used by all Function Executors and all the container resources are available to all Function Executors.
194
- function_executors_ephimeral_disks_path="/",
195
- host_overhead_cpus=0,
196
- host_overhead_memory_gb=0,
197
- host_overhead_function_executors_ephimeral_disks_gb=0,
198
- )
199
-
200
- prometheus_client.Info("cli", "CLI information").info(
201
- {
202
- "package": "indexify",
203
- }
204
- )
205
-
206
- Executor(
207
- id=executor_id,
208
- flavor=ExecutorFlavor.OSS,
209
- version=executor_version,
210
- labels=kv_labels,
211
- health_checker=GenericHealthChecker(),
212
- code_path=executor_cache,
213
- function_allowlist=_parse_function_uris(function_uris),
214
- function_executor_server_factory=SubprocessFunctionExecutorServerFactory(),
215
- server_addr=server_addr,
216
- grpc_server_addr=grpc_server_addr,
217
- config_path=config_path,
218
- monitoring_server_host=monitoring_server_host,
219
- monitoring_server_port=monitoring_server_port,
220
- enable_grpc_state_reconciler=enable_grpc_state_reconciler,
221
- blob_store=blob_store,
222
- host_resources_provider=host_resources_provider,
223
- ).run()
224
-
225
-
226
- def _parse_function_uris(uri_strs: Optional[List[str]]) -> Optional[List[FunctionURI]]:
227
- if uri_strs is None:
228
- return None
229
-
230
- uris: List[FunctionURI] = []
231
- for uri_str in uri_strs:
232
- tokens = uri_str.split(":")
233
- # FIXME bring this back when we have a dynamic scheduler
234
- # if len(tokens) != 4:
235
- if len(tokens) < 3 and len(tokens) > 4:
236
- raise typer.BadParameter(
237
- "Function should be specified as <namespace>:<workflow>:<function>:<version> or"
238
- "<namespace>:<workflow>:<function>"
239
- )
240
- try:
241
- version = tokens[3]
242
- except IndexError:
243
- version = None
244
- uris.append(
245
- FunctionURI(
246
- namespace=tokens[0],
247
- compute_graph=tokens[1],
248
- compute_fn=tokens[2],
249
- version=version,
250
- )
251
- )
252
- return uris
253
-
254
-
255
- def _create_image(image: Image, python_sdk_path):
256
- console.print(
257
- Text("Creating image for ", style="cyan"),
258
- Text(f"`{image._image_name}`", style="cyan bold"),
259
- )
260
- _build_image(image=image, python_sdk_path=python_sdk_path)
261
-
262
-
263
- def _build_image(image: Image, python_sdk_path: Optional[str] = None):
264
- built_image, generator = image.build(python_sdk_path=python_sdk_path)
265
- for output in generator:
266
- print(output)
267
- print(f"built image: {built_image.tags[0]}")
@@ -1,92 +0,0 @@
1
- from typing import Any, Dict, List, Optional
2
-
3
- from pydantic import BaseModel
4
-
5
-
6
- class DataPayload(BaseModel):
7
- path: str
8
- size: int
9
- sha256_hash: str
10
- content_type: Optional[str] = None
11
-
12
-
13
- class NodeGPU(BaseModel):
14
- count: int
15
- model: str
16
-
17
-
18
- class TaskResources(BaseModel):
19
- cpus: float
20
- memory_mb: int
21
- ephemeral_disk_mb: int
22
- gpu: Optional[NodeGPU] = None
23
-
24
-
25
- class TaskRetryPolicy(BaseModel):
26
- max_retries: int
27
- initial_delay_sec: float
28
- max_delay_sec: float
29
- delay_multiplier: float
30
-
31
-
32
- class Task(BaseModel):
33
- id: str
34
- namespace: str
35
- compute_graph: str
36
- compute_fn: str
37
- invocation_id: str
38
- input_key: str
39
- reducer_output_id: Optional[str] = None
40
- graph_version: str
41
- image_uri: Optional[str] = None
42
- "image_uri defines the URI of the image of this task. Optional since some executors do not require it."
43
- secret_names: Optional[List[str]] = None
44
- "secret_names defines the names of the secrets to set on function executor. Optional for backward compatibility."
45
- graph_payload: Optional[DataPayload] = None
46
- input_payload: Optional[DataPayload] = None
47
- reducer_input_payload: Optional[DataPayload] = None
48
- output_payload_uri_prefix: Optional[str] = None
49
- timeout: Optional[int] = None # in seconds
50
- resources: Optional[TaskResources] = None
51
- retry_policy: Optional[TaskRetryPolicy] = None
52
-
53
-
54
- class FunctionURI(BaseModel):
55
- namespace: str
56
- compute_graph: str
57
- compute_fn: str
58
- version: Optional[str] = None
59
-
60
-
61
- class ExecutorMetadata(BaseModel):
62
- id: str
63
- executor_version: str
64
- addr: str
65
- function_allowlist: Optional[List[FunctionURI]] = None
66
- labels: Dict[str, Any]
67
-
68
-
69
- class RouterOutput(BaseModel):
70
- edges: List[str]
71
-
72
-
73
- class TaskResult(BaseModel):
74
- router_output: Optional[RouterOutput] = None
75
- outcome: str
76
- namespace: str
77
- compute_graph: str
78
- compute_fn: str
79
- invocation_id: str
80
- executor_id: str
81
- task_id: str
82
- reducer: bool = False
83
-
84
-
85
- class IngestFnOutputsResponse(BaseModel):
86
- data_payloads: List[DataPayload]
87
- stdout: Optional[DataPayload] = None
88
- stderr: Optional[DataPayload] = None
89
-
90
-
91
- TASK_OUTCOME_SUCCESS = "success"
92
- TASK_OUTCOME_FAILURE = "failure"