Skip to content

Commit

Permalink
Fix workflow thread issue pytorch#1511
Browse files Browse the repository at this point in the history
  • Loading branch information
maaquib committed Mar 23, 2022
1 parent 375f004 commit 29b1151
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ public WorkFlow getWorkflow(String workflowName) {
}

public void predict(ChannelHandlerContext ctx, String wfName, RequestInput input)
throws WorkflowNotFoundException {
throws WorkflowNotFoundException, WorkflowException {
WorkFlow wf = workflowMap.get(wfName);
if (wf != null) {
DagExecutor dagExecutor = new DagExecutor(wf.getDag());
Expand Down Expand Up @@ -420,6 +420,11 @@ public void predict(ChannelHandlerContext ctx, String wfName, RequestInput input
error[error.length - 1].strip()));
return null;
});
try {
predictionFuture.get();
} catch (ExecutionException | InterruptedException e) {
throw new WorkflowException("Workflow failed ", e);
}
} else {
throw new WorkflowNotFoundException("Workflow not found: " + wfName);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public void handleRequest(

private void handlePredictions(
ChannelHandlerContext ctx, FullHttpRequest req, String[] segments)
throws WorkflowNotFoundException {
throws WorkflowNotFoundException, WorkflowException {
RequestInput input = parseRequest(ctx, req);
logger.info(input.toString());
String wfName = segments[2];
Expand Down

0 comments on commit 29b1151

Please sign in to comment.