feat: add AllocationCreated and AllocationCompleted events#14
Merged
Conversation
calavera
approved these changes
Jan 16, 2026
cea6107 to
dc0f9e0
Compare
Refactors request state change events to clearly separate two distinct lifecycles: - Function Run lifecycle: the logical unit of work (may have multiple execution attempts) - Allocation lifecycle: a single physical execution attempt on an executor Changes: - Add AllocationCreated event (renamed from FunctionRunAssigned) - Add AllocationCompleted event for when an execution attempt finishes - Update FunctionRunCompleted to represent final function run outcome - Keep allocation_id as optional in FunctionRunCompleted for backward compatibility - Maintain backward compatibility with FunctionRunAssigned type alias - Update RequestStateChangeEvent enum and all helper methods - Add comprehensive backward compatibility tests Backward compatibility: - Old servers sending FunctionRunAssigned → deserializes correctly - Old servers sending FunctionRunCompleted (with allocation_id) → deserializes correctly - New servers sending AllocationCreated/AllocationCompleted → works as expected This aligns with tensorlakeai/indexify PR #2042.
dc0f9e0 to
b4f6122
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR refactors request state change events to clearly separate two distinct lifecycles, aligning with tensorlakeai/indexify PR #2042:
Changes
New Event Types
AllocationCreated- Event emitted when an allocation (execution attempt) is created and assigned to an executorAllocationCompleted- Event emitted when an allocation (execution attempt) completes with an outcomeModified Event Type
FunctionRunCompleted- Now represents when a function run reaches its final outcome (after all retries exhausted or success). No longer containsallocation_idsince it represents the logical function run, not a specific execution attempt.Backward Compatibility
FunctionRunAssignedkept as a type alias toAllocationCreatedFunctionRunAssignedvariant in the enum deserializes toAllocationCreatedExample Event Flow
With retry after executor removal:
Testing
cargo checkpasses