-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
core[patch]: Passing the input object to the Retry Attempt Handler. #5081
core[patch]: Passing the input object to the Retry Attempt Handler. #5081
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Hi, Any thoughts on this? |
Hi, @jacoblee93 Any chance to have a look into this so we can get it merged? Thank you! |
Sorry for the delay! Looking now! |
…runnable-retry-input
Hey @mauriciocirelli, does it make sense to pass the entire input back for |
Not at all. |
What about just setting it on the thrown error: let firstException;
for (let i = 0; i < results.length; i += 1) {
const result = results[i];
const resultMapIndex = remainingIndexes[i];
// eslint-disable-next-line no-instanceof/no-instanceof
if (result instanceof Error) {
if (firstException === undefined) {
firstException = result;
(firstException as any).input = foo
}
}
resultsMap[resultMapIndex.toString()] = result;
}
if (firstException) {
throw firstException;
} |
Sounds good. Have just pushed the changes. |
LGTM just fix test case |
My bad. Looking into it. |
And run |
Yeah. I have seen that workflow failing too. |
Thank you! |
Im happy to contribute. Like this kind of PR, that helps making (mine and others) code cleaner. |
Getting:
Can fix myself in a bit |
I am waiting for everything to finish so I can push it... do not worry. It is good for me to learn the workflows and how to fix them. |
Thank you! |
Hi,
This is related to the following discussion: How to capture and use the exception error on a Runnable With Retry Chain?.
Passing the input object to the retry attempt handler allows the developer to change it with the error information, making the chain capable of fixing the error in the next loop.
Retrying without fixing the error is very limited.. sometimes retrying the same calls would fix the issue, but usually, it doesnt.
Something like this would do the job:
The only thing that I would like to improve here is the
async _batch<ReturnExceptions extends boolean = false>( inputs: RunInput[], configs?: RunnableConfig[], runManagers?: (CallbackManagerForChainRun | undefined)[], batchOptions?: RunnableBatchOptions)
call (line 1375):Is there a way to capture just the input that caused the exception? I am working around it passing the whole
inputs
array, but I think it would be nicer to just pass the faulty one.I hope this interests the community.
Thank you.