Insert many task executions.
The task executions to insert.
Get many task executions by id and optionally filter them.
The requests to get the task executions.
The task executions.
Get many task executions by sleeping task unique id.
The requests to get the task executions.
The task executions.
Update many task executions by id and optionally filter them. Each request should be atomic.
The requests to update the task executions.
Update many task executions by id and insert children task executions if updated. Each request should be atomic.
The requests to update the task executions.
Update task executions by status and start at less than and return the task executions that
were updated. The task executions are ordered by startAt
ascending.
Update expiresAt = updateExpiresAtWithStartedAt + existingTaskExecution.timeoutMs
.
The request to update the task executions.
The status of the task executions to update.
The start at less than of the task executions to update.
The update object.
The startedAt
value to update the expires at
with.
The maximum number of task executions to update.
The task executions that were updated.
Update task executions by status and on children finished processing status and active
children task executions count zero and return the task executions that were updated. The task
executions are ordered by updatedAt
ascending.
The request to update the task executions.
The status of the task executions to update.
The on children finished processing status of the task executions to update.
The update object.
The maximum number of task executions to update.
The task executions that were updated.
Update task executions by close status and return the task executions that were updated. The
task executions are ordered by updatedAt
ascending.
The request to update the task executions.
The close status of the task executions to update.
The update object.
The maximum number of task executions to update.
The task executions that were updated.
Update task executions by is sleeping task and expires at less than and return the number of
task executions that were updated. The task executions are ordered by expiresAt
ascending.
The request to update the task executions.
The status of the task executions to update.
The is sleeping task of the task executions to update.
The expires at less than of the task executions to update.
The update object.
The maximum number of task executions to update.
The number of task executions that were updated.
Update task executions by on children finished processing expires at less than and return the
number of task executions that were updated. The task executions are ordered by
onChildrenFinishedProcessingExpiresAt
ascending.
The request to update the task executions.
The on children finished processing expires at less than of the task executions to update.
The update object.
The maximum number of task executions to update.
The number of task executions that were updated.
Update task executions by close expires at less than and return the number of task executions
that were updated. The task executions are ordered by closeExpiresAt
ascending.
The request to update the task executions.
The close expires at less than of the task executions to update.
The update object.
The maximum number of task executions to update.
The task executions that were updated.
Update task executions by executor id and needs promise cancellation. The task executions are
ordered by updatedAt
ascending.
The request to update the task executions.
The id of the executor.
The needs promise cancellation of the task executions to update.
The update object.
The maximum number of task executions to update.
The task executions that were updated.
Get many task executions by parent execution id.
The requests to get the task executions.
The task executions.
Update many task executions by parent execution id and is finished. Each request should be atomic.
The requests to update the task executions.
Update task executions by is finished and close status. Also, decrement parent active children
count for all these task executions atomically along with the update. The task executions are
ordered by updatedAt
ascending.
The request to update the task executions.
The is finished of the task executions to update.
The close status of the task executions to update.
The update object.
The maximum number of task executions to update.
The number of task executions that were updated.
Delete task execution by id. This is used for testing. Ideally the storage implementation should have a test and production mode and this method should be a no-op in production.
The request to delete the task execution.
The id of the task execution to delete.
Delete all task executions. This is used for testing. Ideally the storage implementation should have a test and production mode and this method should be a no-op in production.
The storage interface for persisting task execution state. Implementations must ensure all operations are atomic to maintain consistency in distributed environments.
If the implementation is not atomic, use TaskExecutionsStorageWithMutex to wrap the storage implementation and make all operations atomic.
If the implementation doesn't support batching methods, use TaskExecutionsStorageWithBatching to wrap the storage implementation and implement the batching methods.
Implementation Requirements
Required Database Indexes
For optimal performance, create these indexes in your storage backend:
Unique Indexes:
uniqueIndex(executionId)
uniqueIndex(sleepingTaskUniqueId)
- sparse/partial index where not nullNon-unique Indexes (order matters for performance):
index(status, startAt)
- for processing ready task executionsindex(status, onChildrenFinishedProcessingStatus, activeChildrenCount, updatedAt)
- for processing parent task executions when children are finished processingindex(closeStatus, updatedAt)
- for task execution closure handlingindex(status, isSleepingTask, expiresAt)
- for task execution timeout handlingindex(onChildrenFinishedProcessingExpiresAt)
- for recovery during processing parent task executions when children are finished processingindex(closeExpiresAt)
- for task execution closure handling recoveryindex(executorId, needsPromiseCancellation, updatedAt)
- for task execution cancellationindex(parent.executionId, isFinished)
- for child task execution queriesindex(isFinished, closeStatus, updatedAt)
- for finished task execution cleanupAvailable Implementations
Example