Skip to content
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

Merged
merged 1 commit into from Oct 4, 2018

Conversation

angoenka
Copy link
Contributor

@angoenka angoenka commented Oct 2, 2018

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:

  • Format the pull request title like [BEAM-XXX] Fixes bug in ApproximateQuantiles, where you replace BEAM-XXX with the appropriate JIRA issue, if applicable. This will automatically link the pull request to the issue.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

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)

Lang SDK Apex Dataflow Flink Gearpump Samza Spark
Go Build Status --- --- --- --- --- ---
Java Build Status Build Status Build Status Build Status Build Status Build Status Build Status
Python Build Status --- Build Status
Build Status
Build Status --- --- ---

@angoenka
Copy link
Contributor Author

angoenka commented Oct 2, 2018

R: @mxm @tweise

Copy link
Contributor

@mxm mxm left a 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){
Copy link
Contributor

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){
Copy link
Contributor

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);
}
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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.

Copy link
Contributor Author

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) {}
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

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?

Copy link
Contributor

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.

Copy link
Contributor Author

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.

@angoenka angoenka force-pushed the java_pvr_waituntilfinish_connection branch 3 times, most recently from cbfd4a2 to f15adac Compare October 3, 2018 17:53
@angoenka angoenka force-pushed the java_pvr_waituntilfinish_connection branch from f15adac to 863b904 Compare October 3, 2018 17:55
@mxm mxm merged commit 0ce9eac into apache:master Oct 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants