Replace FutureMessage with ivalue::Future in RRefContext (#49960)

Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/49960

Test Plan: Imported from OSS

Reviewed By: lw

Differential Revision: D25730530

Pulled By: mrshenli

fbshipit-source-id: 5d54572c653592d79c40aed616266c87307a1ad8
This commit is contained in:
Shen Li
2021-01-07 19:43:44 -08:00
committed by Facebook GitHub Bot
parent 25ef605132
commit 008206decc
10 changed files with 72 additions and 78 deletions

View File

@ -67,21 +67,21 @@ RRefForkData RRef::fork() const {
void RRef::handleError(
RPCErrorType errorType,
const FutureMessage& futMessage) {
const JitFuture& jitFuture) {
static std::unordered_map<
RPCErrorType,
std::function<void(const FutureMessage& fm)>,
std::function<void(const JitFuture& jitFuture)>,
std::hash<int>>
errorHandlers = {
{RPCErrorType::TIMEOUT,
[this](const FutureMessage& /* unused */) { setTimedOut(); }},
[this](const JitFuture& /* unused */) { setTimedOut(); }},
{RPCErrorType::INTENTIONAL_FAILURE,
[this](const FutureMessage& /* unused */) { setTimedOut(); }},
{RPCErrorType::UNKNOWN_ERROR, [](const FutureMessage& fm) {
[this](const JitFuture& /* unused */) { setTimedOut(); }},
{RPCErrorType::UNKNOWN_ERROR, [](const JitFuture& jitFuture) {
// Default error handler
RRefContext::handleException(fm);
RRefContext::handleException(jitFuture);
}}};
errorHandlers.find(errorType)->second(futMessage);
errorHandlers.find(errorType)->second(jitFuture);
}
////////////////////////// UserRRef /////////////////////////////////////