[
https://issues.apache.org/jira/browse/BEAM-7720?focusedWorklogId=296424&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-296424
]
ASF GitHub Bot logged work on BEAM-7720:
----------------------------------------
Author: ASF GitHub Bot
Created on: 16/Aug/19 16:55
Start Date: 16/Aug/19 16:55
Worklog Time Spent: 10m
Work Description: chadrik commented on pull request #9347: [BEAM-7720]
Fix the exception type of InMemoryJobService when job id not found
URL: https://github.com/apache/beam/pull/9347#discussion_r314805096
##########
File path:
runners/java-fn-execution/src/main/java/org/apache/beam/runners/fnexecution/jobsubmission/InMemoryJobService.java
##########
@@ -253,6 +253,8 @@ public void getState(
GetJobStateResponse response =
GetJobStateResponse.newBuilder().setState(state).build();
responseObserver.onNext(response);
responseObserver.onCompleted();
+ } catch (StatusException e) {
Review comment:
I updated `StatusException` to `StatusRuntimeException | StatusException`
everywhere, but I'm a bit unclear on what's actually throwing the
`StatusRuntimeException`. I searched the code for `StatusRuntimeException` and
I did not see a clear path from any of those cases to here.
For example, looking at this code I didn't see anything suspicious inside
the try/catch block:
```java
@Override
public void getState(
GetJobStateRequest request, StreamObserver<GetJobStateResponse>
responseObserver) {
LOG.trace("{} {}", GetJobStateRequest.class.getSimpleName(), request);
String invocationId = request.getJobId();
try {
JobInvocation invocation = getInvocation(invocationId);
JobState.Enum state = invocation.getState();
GetJobStateResponse response =
GetJobStateResponse.newBuilder().setState(state).build();
responseObserver.onNext(response);
responseObserver.onCompleted();
} catch (StatusRuntimeException | StatusException e) {
responseObserver.onError(e);
} catch (Exception e) {
String errMessage =
String.format("Encountered Unexpected Exception for Invocation
%s", invocationId);
LOG.error(errMessage, e);
responseObserver.onError(Status.INTERNAL.withCause(e).asException());
}
}
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 296424)
Time Spent: 50m (was: 40m)
> Fix the exception type of InMemoryJobService when job id not found
> ------------------------------------------------------------------
>
> Key: BEAM-7720
> URL: https://issues.apache.org/jira/browse/BEAM-7720
> Project: Beam
> Issue Type: Bug
> Components: beam-model
> Reporter: Chad Dombrova
> Assignee: Chad Dombrova
> Priority: Major
> Time Spent: 50m
> Remaining Estimate: 0h
>
> The contract in beam_job_api.proto for `CancelJobRequest`,
> `GetJobStateRequest`, and `GetJobPipelineRequest` states:
>
> {noformat}
> // Throws error NOT_FOUND if the jobId is not found{noformat}
>
> However, `InMemoryJobService` is handling this exception incorrectly by
> rethrowing `NOT_FOUND` exceptions as `INTERNAL`.
> neither `JobMessagesRequest` nor `GetJobMetricsRequest` state their contract
> wrt exceptions, but they should probably be updated to handle `NOT_FOUND` in
> the same way.
>
--
This message was sent by Atlassian JIRA
(v7.6.14#76016)