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
[BEAM-4176] Store and serve termination state after portable job termination #6537
[BEAM-4176] Store and serve termination state after portable job termination #6537
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. I think we can close the jobService once we have reached the terminal state.
} | ||
|
||
@Override | ||
public State getState() { | ||
if(terminationState != null){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
space missing after if
and )
@@ -89,6 +95,9 @@ public State waitUntilFinish(Duration duration) { | |||
|
|||
@Override | |||
public State waitUntilFinish() { | |||
if(terminationState != null){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
space missing after if
and )
jobService.close(); | ||
} catch (Exception e) { | ||
LOG.warn("Error cleaning up job service", e); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why should we keep the connection to the JobServer if we have reached the final state? Final implies that no other state can be obtained.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current behavior of connection cleanup is un-intuitive. The connection use to get closed only if the user called waitUntillFinish while if user did not call WUF then the connection is not closed. Hence removing the connection closing here so that the connection is only closed explicitly in close call.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be ok to have a AutoCloseable close method and call it from here to close eagerly when the terminal state has already been reached.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense
@Override | ||
public void close() throws Exception { | ||
// Close the job service. | ||
try (CloseableResource<JobServiceBlockingStub> jobService = this.jobService) {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wonder if we need some cleanup registry in the future to close all these connections when we shutdown the JVM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, we will need it. Also as the jobServer is not persistent, the PipelineResult object usability is limited.
One approach can be to just keep on requesting for state after job creation.
Once we reach the termination state then close the connection.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we go with this approach?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A background thread which does the polling might not be desired by the user. On the other hand, when waitUntilFinished()
is called polling is explicitly requested. We would like to do the polling because it helps to find out whether to close the JobServer connection but I think that needs to be handled in a different way, e.g. with a registry of some sort.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, I would differ this change to a later time.
cbfd4a2
to
f15adac
Compare
f15adac
to
863b904
Compare
The jobserver connection is closed after job is terminated which means user can't check the job status again even when its terminated. Store and provide terminated job status to user.
Follow this checklist to help us incorporate your contribution quickly and easily:
[BEAM-XXX] Fixes bug in ApproximateQuantiles
, where you replaceBEAM-XXX
with the appropriate JIRA issue, if applicable. This will automatically link the pull request to the issue.It will help us expedite review of your Pull Request if you tag someone (e.g.
@username
) to look at it.Post-Commit Tests Status (on master branch)