indexify 0.4.13__py3-none-any.whl → 0.4.14__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.
@@ -252,7 +252,7 @@ class FunctionExecutorController:
252
252
  """Shutsdown the Function Executor and frees all of its resources.
253
253
 
254
254
  No task outcomes and outputs are getting reported to Server after this call.
255
- Doesn't raise any exceptions. Blocks until the shutdown is complete.
255
+ Doesn't raise any exceptions. Blocks until the shutdown is complete. Idempotent.
256
256
  """
257
257
  self._add_event(ShutdownInitiated(), source="shutdown")
258
258
  try:
@@ -261,10 +261,9 @@ class FunctionExecutorController:
261
261
  pass # Expected exception on shutdown
262
262
  except Exception as e:
263
263
  self._logger.error(
264
- "function executor controller control loop raised unexpected exception",
264
+ "function executor controller control loop task raised unexpected exception",
265
265
  exc_info=e,
266
266
  )
267
- self._logger.info("function executor controller shutdown finished")
268
267
 
269
268
  def _update_internal_state(self, new_state: _FE_CONTROLLER_STATE) -> None:
270
269
  """Updates the internal state of the Function Executor Controller.
@@ -802,7 +801,7 @@ class FunctionExecutorController:
802
801
  self._state_reporter.remove_function_executor_state(self.function_executor_id())
803
802
  self._state_reporter.schedule_state_report()
804
803
 
805
- self._logger.info("function executor controller control loop finished")
804
+ self._logger.info("function executor controller shutdown finished")
806
805
  debug_print_events(events=self._events, logger=self._logger)
807
806
 
808
807
 
@@ -66,6 +66,7 @@ class ExecutorStateReconciler:
66
66
  self._desired_states_reader_task: Optional[asyncio.Task] = None
67
67
  self._reconciliation_loop_task: Optional[asyncio.Task] = None
68
68
  self._function_executor_controllers: Dict[str, FunctionExecutorController] = {}
69
+ self._shutting_down_fe_ids: Set[str] = set()
69
70
  self._last_server_clock: Optional[int] = None
70
71
 
71
72
  self._last_desired_state_lock = asyncio.Lock()
@@ -320,14 +321,35 @@ class ExecutorStateReconciler:
320
321
  logger.error("failed adding Function Executor", exc_info=e)
321
322
 
322
323
  def _remove_function_executor_controller(self, function_executor_id: str) -> None:
323
- fe_controller: FunctionExecutorController = (
324
- self._function_executor_controllers.pop(function_executor_id)
325
- )
324
+ # Don't remove the FE controller from self._function_executor_controllers until
325
+ # its shutdown is complete. Otherwise, if Server re-adds the FE to desired state
326
+ # before FE shutdown completes then we'll have two FE controllers for the same
327
+ # FE ID which results in many bugs.
328
+ if function_executor_id in self._shutting_down_fe_ids:
329
+ return
330
+
331
+ self._shutting_down_fe_ids.add(function_executor_id)
326
332
  asyncio.create_task(
327
- fe_controller.shutdown(),
333
+ self._shutdown_function_executor_controller(function_executor_id),
328
334
  name=f"Shutdown Function Executor {function_executor_id}",
329
335
  )
330
336
 
337
+ async def _shutdown_function_executor_controller(
338
+ self, function_executor_id: str
339
+ ) -> None:
340
+ # We are not cancelling this aio task in self.shutdown(). Because of this the code here should
341
+ # not fail if the FE controller is not found in internal data structures. It can be removed
342
+ # by self.shutdown() at any time while we're running this aio task.
343
+ fe_controller: Optional[FunctionExecutorController] = (
344
+ self._function_executor_controllers.get(function_executor_id)
345
+ )
346
+ if fe_controller is None:
347
+ return
348
+
349
+ await fe_controller.shutdown()
350
+ self._function_executor_controllers.pop(function_executor_id, None)
351
+ self._shutting_down_fe_ids.discard(function_executor_id)
352
+
331
353
  def _reconcile_tasks(self, task_allocations: Iterable[TaskAllocation]):
332
354
  valid_task_allocations: List[TaskAllocation] = self._valid_task_allocations(
333
355
  task_allocations
@@ -393,8 +415,6 @@ class ExecutorStateReconciler:
393
415
  task_allocation.function_executor_id
394
416
  not in self._function_executor_controllers
395
417
  ):
396
- # Current policy: don't report task outcomes for tasks that didn't run.
397
- # This is required to simplify the protocol so Server doesn't need to care about task states.
398
418
  logger.error(
399
419
  "received TaskAllocation for a Function Executor that doesn't exist, dropping it from desired state"
400
420
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: indexify
3
- Version: 0.4.13
3
+ Version: 0.4.14
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
@@ -17,7 +17,7 @@ Requires-Dist: aiohttp (>=3.11.0,<4.0.0)
17
17
  Requires-Dist: boto3 (>=1.37.30,<2.0.0)
18
18
  Requires-Dist: prometheus-client (>=0.21.1,<0.22.0)
19
19
  Requires-Dist: psutil (>=7.0.0,<8.0.0)
20
- Requires-Dist: tensorlake (==0.2.12)
20
+ Requires-Dist: tensorlake (==0.2.15)
21
21
  Project-URL: Repository, https://github.com/tensorlakeai/indexify
22
22
  Description-Content-Type: text/markdown
23
23
 
@@ -27,7 +27,7 @@ indexify/executor/function_executor_controller/create_function_executor.py,sha25
27
27
  indexify/executor/function_executor_controller/debug_event_loop.py,sha256=VJOKe_c9HjIDVCjhMY3Yqyeq1tAM1eVa2chZa6CMf-U,1016
28
28
  indexify/executor/function_executor_controller/downloads.py,sha256=XjCUmLY_jrI3AlnXC7aDwwKWTvsQjV7I9AXzrbIeY6c,7063
29
29
  indexify/executor/function_executor_controller/events.py,sha256=r2K3k9Nnkzh0j6HHZC0DxOdQ3HtCmzt4eN2DIwTa7NM,5456
30
- indexify/executor/function_executor_controller/function_executor_controller.py,sha256=CpIpZ0l8s5O22RLq_rQOBXRYrDq3YAWFXGQF1BfCbxQ,36415
30
+ indexify/executor/function_executor_controller/function_executor_controller.py,sha256=Ff_1O5m03xdw-Ut04Bi8GmCjmk_VkCVyZ8nBHgl-7CE,36352
31
31
  indexify/executor/function_executor_controller/function_executor_startup_output.py,sha256=PXg2r440kqHI3oHGZbb58ehuAuW_fmEdxLTAa-0V3p4,715
32
32
  indexify/executor/function_executor_controller/loggers.py,sha256=zEY2nt15gboX3SX6Kh1xjeCljZJZSE4lp27qNrg8yPY,3637
33
33
  indexify/executor/function_executor_controller/message_validators.py,sha256=aNiZhYA87pnxUJtZKvKGDt40rfox-TYH2J6mW7o-Pkw,2981
@@ -57,13 +57,13 @@ indexify/executor/monitoring/metrics.py,sha256=Dx2wPcTKvbd5Y5rGOfeyscFtAQ2DZ16_s
57
57
  indexify/executor/monitoring/prometheus_metrics_handler.py,sha256=KiGqSf7rkXTfbDwThyXFpFe2jnuZD5q-5SBP_0GDo8Y,591
58
58
  indexify/executor/monitoring/server.py,sha256=yzdYhcxnmY6uTQUMt3vatF5jilN52ZtfFseOmHyQpTo,1254
59
59
  indexify/executor/monitoring/startup_probe_handler.py,sha256=zXXsBU15SMlBx1bSFpxWDfed1VHtKKnwvLQ8-frpG98,425
60
- indexify/executor/state_reconciler.py,sha256=pZ4a0OHeLkPHTuqiwh1G8YXvh23kERVUWZemol6F5E8,17787
60
+ indexify/executor/state_reconciler.py,sha256=tibVENdOTCU-cDoi7v6WTx223wKeBt3LAg2Fc0vwkNo,18768
61
61
  indexify/executor/state_reporter.py,sha256=0qs9n2n8bWn77hdW8qsuUqHS7G8iyW7-9_-s8l6aJSU,14195
62
62
  indexify/proto/executor_api.proto,sha256=MEsBzpL5tlBd6Yc3ZfheQ60DbXAZWQWGM1dlldhH4i8,12240
63
63
  indexify/proto/executor_api_pb2.py,sha256=w2Wj1MEtTihNZ4TvPKPYDjMryO52fPa7A4dKv7vb__s,16236
64
64
  indexify/proto/executor_api_pb2.pyi,sha256=AEHW4YFm5FT8f66qKGkPH36szlWgCgXrH3CQ8rgxSps,22754
65
65
  indexify/proto/executor_api_pb2_grpc.py,sha256=JpT5K6jiS0NJVNyTt1mAPpyJMXuEGeNN2V6R3KmLHZ4,7607
66
- indexify-0.4.13.dist-info/METADATA,sha256=ZN16aCArggFFTIlaWelbhaF36t2CEtTAm6dbJxVbFU0,1116
67
- indexify-0.4.13.dist-info/WHEEL,sha256=RaoafKOydTQ7I_I3JTrPCg6kUmTgtm4BornzOqyEfJ8,88
68
- indexify-0.4.13.dist-info/entry_points.txt,sha256=rMJqbE5KPZIXTPIfAtVIM4zpUElqYVgEYd6i7N23zzg,49
69
- indexify-0.4.13.dist-info/RECORD,,
66
+ indexify-0.4.14.dist-info/METADATA,sha256=gjWx_i1QygT4oZTyzDfDVSesR0AxEif3j-iB9LGT0CQ,1116
67
+ indexify-0.4.14.dist-info/WHEEL,sha256=RaoafKOydTQ7I_I3JTrPCg6kUmTgtm4BornzOqyEfJ8,88
68
+ indexify-0.4.14.dist-info/entry_points.txt,sha256=rMJqbE5KPZIXTPIfAtVIM4zpUElqYVgEYd6i7N23zzg,49
69
+ indexify-0.4.14.dist-info/RECORD,,