Class BulkInferenceExecutionState
java.lang.Object
org.elasticsearch.xpack.esql.inference.bulk.BulkInferenceExecutionState
Tracks the state of a bulk inference execution, including sequencing, failure management, and buffering of inference responses for
ordered output construction.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidfetchBufferedResponse(long seqNo) Retrieves and removes the buffered response by sequence number.voidfinish()Marks the bulk as finished, indicating that all inference requests have been sent.booleanfinished()Indicates whether the entire bulk execution is marked as finished and all responses have been successfully persisted.longGenerates a new unique sequence number for an inference request.Returns the recorded failure, if any.longHighest generated sequence number.longReturns the highest sequence number marked as persisted, such that all lower sequence numbers have also been marked as persisted.longReturns the highest sequence number marked as processed, such that all lower sequence numbers have also been marked as processed.booleanReturns whether any failure has been recorded during execution.voidmarkSeqNoAsPersisted(long seqNo) Marks an inference response as persisted.voidonInferenceException(long seqNo, Exception e) * Handles an exception thrown during inference execution.voidonInferenceResponse(long seqNo, InferenceAction.Response response) Add an inference response to the buffer and marks the corresponding sequence number as processed.
-
Constructor Details
-
BulkInferenceExecutionState
public BulkInferenceExecutionState()
-
-
Method Details
-
generateSeqNo
public long generateSeqNo()Generates a new unique sequence number for an inference request. -
getPersistedCheckpoint
public long getPersistedCheckpoint()Returns the highest sequence number marked as persisted, such that all lower sequence numbers have also been marked as persisted. -
getProcessedCheckpoint
public long getProcessedCheckpoint()Returns the highest sequence number marked as processed, such that all lower sequence numbers have also been marked as processed. -
getMaxSeqNo
public long getMaxSeqNo()Highest generated sequence number. -
markSeqNoAsPersisted
public void markSeqNoAsPersisted(long seqNo) Marks an inference response as persisted.- Parameters:
seqNo- The corresponding sequence number
-
onInferenceResponse
Add an inference response to the buffer and marks the corresponding sequence number as processed.- Parameters:
seqNo- The sequence number of the inference request.response- The inference response.
-
onInferenceException
* Handles an exception thrown during inference execution. Records the failure and marks the corresponding sequence number as processed.- Parameters:
seqNo- The sequence number of the inference request.e- The exception
-
fetchBufferedResponse
Retrieves and removes the buffered response by sequence number.- Parameters:
seqNo- The sequence number of the response to fetch.
-
hasFailure
public boolean hasFailure()Returns whether any failure has been recorded during execution. -
getFailure
Returns the recorded failure, if any. -
addFailure
-
finished
public boolean finished()Indicates whether the entire bulk execution is marked as finished and all responses have been successfully persisted. -
finish
public void finish()Marks the bulk as finished, indicating that all inference requests have been sent.
-