indexify 0.4.28__py3-none-any.whl → 0.4.29__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.
@@ -23,9 +23,11 @@ from .metrics.executor import (
23
23
  metric_executor_info,
24
24
  metric_executor_state,
25
25
  )
26
+ from .monitoring.desired_state_handler import DesiredStateHandler
26
27
  from .monitoring.health_check_handler import HealthCheckHandler
27
28
  from .monitoring.health_checker.health_checker import HealthChecker
28
29
  from .monitoring.prometheus_metrics_handler import PrometheusMetricsHandler
30
+ from .monitoring.reported_state_handler import ReportedStateHandler
29
31
  from .monitoring.server import MonitoringServer
30
32
  from .monitoring.startup_probe_handler import StartupProbeHandler
31
33
  from .state_reconciler import ExecutorStateReconciler
@@ -59,13 +61,6 @@ class Executor:
59
61
  protocol = "https"
60
62
 
61
63
  self._startup_probe_handler = StartupProbeHandler()
62
- self._monitoring_server = MonitoringServer(
63
- host=monitoring_server_host,
64
- port=monitoring_server_port,
65
- startup_probe_handler=self._startup_probe_handler,
66
- health_probe_handler=HealthCheckHandler(health_checker),
67
- metrics_handler=PrometheusMetricsHandler(),
68
- )
69
64
  self._channel_manager = ChannelManager(
70
65
  server_address=grpc_server_addr,
71
66
  config_path=config_path,
@@ -96,6 +91,15 @@ class Executor:
96
91
  state_reporter=self._state_reporter,
97
92
  logger=self._logger,
98
93
  )
94
+ self._monitoring_server = MonitoringServer(
95
+ host=monitoring_server_host,
96
+ port=monitoring_server_port,
97
+ startup_probe_handler=self._startup_probe_handler,
98
+ health_probe_handler=HealthCheckHandler(health_checker),
99
+ metrics_handler=PrometheusMetricsHandler(),
100
+ reported_state_handler=ReportedStateHandler(self._state_reporter),
101
+ desired_state_handler=DesiredStateHandler(self._state_reconciler),
102
+ )
99
103
  self._run_aio_task: Optional[asyncio.Task] = None
100
104
  self._shutdown_aio_task: Optional[asyncio.Task] = None
101
105
 
@@ -0,0 +1,24 @@
1
+ from aiohttp import web
2
+
3
+ from indexify.proto.executor_api_pb2 import (
4
+ DesiredExecutorState,
5
+ )
6
+
7
+ from ..state_reconciler import ExecutorStateReconciler
8
+ from .handler import Handler
9
+
10
+
11
+ class DesiredStateHandler(Handler):
12
+ def __init__(self, state_reconciler: ExecutorStateReconciler):
13
+ self._state_reconciler = state_reconciler
14
+
15
+ async def handle(self, request: web.Request) -> web.Response:
16
+ desired_state: DesiredExecutorState | None = (
17
+ self._state_reconciler.get_desired_state()
18
+ )
19
+ if desired_state is None:
20
+ return web.Response(
21
+ status=200, text="No desired state received from Server yet"
22
+ )
23
+ else:
24
+ return web.Response(text=str(desired_state))
@@ -0,0 +1,22 @@
1
+ from aiohttp import web
2
+
3
+ from indexify.proto.executor_api_pb2 import (
4
+ ReportExecutorStateRequest,
5
+ )
6
+
7
+ from ..state_reporter import ExecutorStateReporter
8
+ from .handler import Handler
9
+
10
+
11
+ class ReportedStateHandler(Handler):
12
+ def __init__(self, state_reporter: ExecutorStateReporter):
13
+ self._state_reporter = state_reporter
14
+
15
+ async def handle(self, request: web.Request) -> web.Response:
16
+ request: ReportExecutorStateRequest | None = (
17
+ self._state_reporter.last_state_report_request()
18
+ )
19
+ if request is None:
20
+ return web.Response(status=200, text="No state reported so far")
21
+ else:
22
+ return web.Response(text=str(request))
@@ -11,6 +11,8 @@ class MonitoringServer:
11
11
  startup_probe_handler: Handler,
12
12
  health_probe_handler: Handler,
13
13
  metrics_handler: Handler,
14
+ reported_state_handler: Handler,
15
+ desired_state_handler: Handler,
14
16
  ):
15
17
  self._host = host
16
18
  self._port = port
@@ -20,6 +22,8 @@ class MonitoringServer:
20
22
  web.get("/monitoring/startup", startup_probe_handler.handle),
21
23
  web.get("/monitoring/health", health_probe_handler.handle),
22
24
  web.get("/monitoring/metrics", metrics_handler.handle),
25
+ web.get("/state/reported", reported_state_handler.handle),
26
+ web.get("/state/desired", desired_state_handler.handle),
23
27
  ]
24
28
  )
25
29
  self._app_runner: web.AppRunner = web.AppRunner(self._app)
@@ -88,6 +88,9 @@ class ExecutorStateReconciler:
88
88
  )
89
89
  self._last_desired_state: Optional[DesiredExecutorState] = None
90
90
 
91
+ def get_desired_state(self) -> Optional[DesiredExecutorState]:
92
+ return self._last_desired_state
93
+
91
94
  def run(self):
92
95
  """Runs the state reconciler.
93
96
 
@@ -89,6 +89,10 @@ class ExecutorStateReporter:
89
89
  self._pending_task_results: List[TaskResult] = []
90
90
  self._pending_fe_updates: List[FunctionExecutorUpdate] = []
91
91
  self._function_executor_states: Dict[str, FunctionExecutorState] = {}
92
+ self._last_state_report_request: Optional[ReportExecutorStateRequest] = None
93
+
94
+ def last_state_report_request(self) -> Optional[ReportExecutorStateRequest]:
95
+ return self._last_state_report_request
92
96
 
93
97
  def update_executor_status(self, value: ExecutorStatus) -> None:
94
98
  self._executor_status = value
@@ -203,7 +207,11 @@ class ExecutorStateReporter:
203
207
  try:
204
208
  state: ExecutorState = self._current_executor_state()
205
209
  update: ExecutorUpdate = self._remove_pending_update()
210
+ request: ReportExecutorStateRequest = ReportExecutorStateRequest(
211
+ executor_state=state, executor_update=update
212
+ )
206
213
  _log_reported_executor_update(update, self._logger)
214
+ self._last_state_report_request = request
207
215
 
208
216
  with (
209
217
  metric_state_report_rpc_errors.count_exceptions(),
@@ -211,10 +219,7 @@ class ExecutorStateReporter:
211
219
  ):
212
220
  metric_state_report_rpcs.inc()
213
221
  await stub.report_executor_state(
214
- ReportExecutorStateRequest(
215
- executor_state=state, executor_update=update
216
- ),
217
- timeout=_REPORT_RPC_TIMEOUT_SEC,
222
+ request, timeout=_REPORT_RPC_TIMEOUT_SEC
218
223
  )
219
224
  self._state_reported_event.set()
220
225
  self._health_checker.server_connection_state_changed(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: indexify
3
- Version: 0.4.28
3
+ Version: 0.4.29
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
@@ -8,7 +8,7 @@ indexify/executor/blob_store/local_fs_blob_store.py,sha256=nRFawLMbOCCFlCIx2ccmh
8
8
  indexify/executor/blob_store/metrics/blob_store.py,sha256=3lmLU8q4Yx87RIYcy56nmFiNQTPY94pB12ht7X6MyhA,3811
9
9
  indexify/executor/blob_store/s3_blob_store.py,sha256=wJlDBTTaq48Vp1I0LvP2958b1Xe8esvarkr5PVRawU0,7609
10
10
  indexify/executor/channel_manager.py,sha256=ihKfWJmUqQvh4UKXewZLzyJWW_f50P4fnwPqPonrozw,6651
11
- indexify/executor/executor.py,sha256=rM7BmJDqC_YwdwPfDGFGiFO2WxOW3Nj8Z7rwRw8UcFk,6353
11
+ indexify/executor/executor.py,sha256=--qzHfQnbP70hsV7Y1L6dlgsORAi-Ugwu0W795NgYyc,6645
12
12
  indexify/executor/function_allowlist.py,sha256=PCelCW6qIe_2sH11BCKr7LDqarRV5kwNsrfB2EV7Zwo,1772
13
13
  indexify/executor/function_executor/function_executor.py,sha256=dTZ8y15ifu7GKmNLU-SQH5M3COa1_8ec_2439h67Pd8,12381
14
14
  indexify/executor/function_executor/health_checker.py,sha256=IxE0jnC99K_lvnizFLjXqS1942H8-FNAN4AlhLIjg2Y,6373
@@ -52,6 +52,7 @@ indexify/executor/metrics/channel_manager.py,sha256=1dU9bzF3xqBy1nY9Sc66GfQQWnWZ
52
52
  indexify/executor/metrics/executor.py,sha256=8dJXmyGqKlBSrPuyWXW7O2I21uxQ687l-2dYTvz4fmk,398
53
53
  indexify/executor/metrics/state_reconciler.py,sha256=BSlRgvgtwih6QcYrsFU5P2ylaXAsC_X70DbzDuv9NsU,584
54
54
  indexify/executor/metrics/state_reporter.py,sha256=JvyP_IUfJQetEjzmoWe9q6HCA4Ao1GLocaa7Od_jl2g,550
55
+ indexify/executor/monitoring/desired_state_handler.py,sha256=jmpTSQY6VyDbPFGKMpj-dAv0un5dtQmYc1tonQDBWL8,755
55
56
  indexify/executor/monitoring/handler.py,sha256=Cj1cu_LcsAP0tdviqNhoEtGm4h0OJAxxzW9C2YdNXYU,240
56
57
  indexify/executor/monitoring/health_check_handler.py,sha256=e1pEtWFKaVs6H57Z4YLejNECrJtC38PweZc7xTJeqVw,695
57
58
  indexify/executor/monitoring/health_checker/generic_health_checker.py,sha256=vJRV879GrdZFqwTnM9pRLA97LRMutGz2sWRy-KS-tfg,1493
@@ -59,15 +60,16 @@ indexify/executor/monitoring/health_checker/health_checker.py,sha256=B-Q4KM1iEUS
59
60
  indexify/executor/monitoring/health_checker/metrics/health_checker.py,sha256=50JS4JaOdAgSk7iYaBV4J3tGXkRTzmIVR_jVOV66YOc,129
60
61
  indexify/executor/monitoring/metrics.py,sha256=5BpNqDBDQiL2K962WDPQU2eSo5zD6I9vF2flGyBejts,7388
61
62
  indexify/executor/monitoring/prometheus_metrics_handler.py,sha256=KiGqSf7rkXTfbDwThyXFpFe2jnuZD5q-5SBP_0GDo8Y,591
62
- indexify/executor/monitoring/server.py,sha256=yzdYhcxnmY6uTQUMt3vatF5jilN52ZtfFseOmHyQpTo,1254
63
+ indexify/executor/monitoring/reported_state_handler.py,sha256=R1C3tk8CF2xh7pbBgKzM1ADReDMEV9CyIRlAZ9NFado,697
64
+ indexify/executor/monitoring/server.py,sha256=aAKzL9J243Q9_41JY-4tSBdFKXR_ZOMz-DEJNtxfYC4,1483
63
65
  indexify/executor/monitoring/startup_probe_handler.py,sha256=zXXsBU15SMlBx1bSFpxWDfed1VHtKKnwvLQ8-frpG98,425
64
- indexify/executor/state_reconciler.py,sha256=8l4O0IjovnQNI39AQsst4qPb2qFdEncZiEvVl8nLjYI,20248
65
- indexify/executor/state_reporter.py,sha256=zf5UBhBZVv9SQ1Ju_bY8w6D_t1hBZ5YVXhjeFMEgRms,15208
66
+ indexify/executor/state_reconciler.py,sha256=SUhzcazNmVoJMLYTFWcP911irN3zVzugNx11afiUyws,20356
67
+ indexify/executor/state_reporter.py,sha256=zXb6SvD1yA4tMDWxT_p995y8l490hifXRHX4LjN6WOA,15505
66
68
  indexify/proto/executor_api.proto,sha256=YwLeLjyLHhs5qoWLA50uHY2KdKRGfBQBKZwE8VXmzeo,12871
67
69
  indexify/proto/executor_api_pb2.py,sha256=vTG1-2Pp4OnTWFD4GYphgJ3cUbTbDjCOKstKrLBXB-E,16472
68
70
  indexify/proto/executor_api_pb2.pyi,sha256=-6P-ef-fBJF0CTc4UucIzrDLCBVZpIEhEz2qhexvwjk,23175
69
71
  indexify/proto/executor_api_pb2_grpc.py,sha256=u9GEQV4nm_GvApRxjVo806CkgBMBVReb5IVrcaDaliY,7520
70
- indexify-0.4.28.dist-info/METADATA,sha256=gtwcTBq-IRRXsCSEXv4hO2SJuFWQyC_bTJ5MeJEV-f8,1390
71
- indexify-0.4.28.dist-info/WHEEL,sha256=RaoafKOydTQ7I_I3JTrPCg6kUmTgtm4BornzOqyEfJ8,88
72
- indexify-0.4.28.dist-info/entry_points.txt,sha256=rMJqbE5KPZIXTPIfAtVIM4zpUElqYVgEYd6i7N23zzg,49
73
- indexify-0.4.28.dist-info/RECORD,,
72
+ indexify-0.4.29.dist-info/METADATA,sha256=kF8bbOI0OHcO7tHtlyUAsEvFfrlfymHKqlNR9lt6yuM,1390
73
+ indexify-0.4.29.dist-info/WHEEL,sha256=RaoafKOydTQ7I_I3JTrPCg6kUmTgtm4BornzOqyEfJ8,88
74
+ indexify-0.4.29.dist-info/entry_points.txt,sha256=rMJqbE5KPZIXTPIfAtVIM4zpUElqYVgEYd6i7N23zzg,49
75
+ indexify-0.4.29.dist-info/RECORD,,