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

[Part 9]: Introducing Sink::close #159

Merged
merged 2 commits into from
Apr 4, 2022

Conversation

sundargates
Copy link
Collaborator

An explicit close is required because in the new model (Titus), we want the ability to stop tasks gracefully. This means shutting down all the resources that the job is currently consuming. In the old world (Apache Mesos), this was not required because we were forcefully shutting down processes which are both not clean as well as not feasible in the new world.

Context

We are introducing a breaking API change because we want to ensure developers don't forget to close their sinks correctly.

Checklist

  • ./gradlew build compiles code correctly
  • Added new tests where applicable
  • ./gradlew test passes all tests
  • Extended README or added javadocs where applicable
  • Added copyright headers for new files from CONTRIBUTING.md

An explicit close is required because in the new model (Titus), we want the ability to stop tasks gracefully. This means shutting down all the resources that the job is currently consuming. In the old world (Apache Mesos), this was not required because we were forcefully shutting down processes which are both not clean as well as not feasible in the new world.
public void close() throws IOException {
if (pushServerSse != null) {
pushServerSse.shutdown();
} else if (httpServer != null) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: in this case IMO null check is enough to shutdown pushServerSse and httpServer, which is slightly safer if for any reason both of them got created.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea I'm not too worried about it honestly given that the code for setting these fields is just before this method. so even if that changes in the future when you create both the servers for whatever reason, you can easily change the behavior of the close() since it's in the same file.

@codyrioux
Copy link
Contributor

codyrioux commented Apr 4, 2022 via email

Comment on lines +69 to +72
sink.close();
} finally {
subscription.unsubscribe();
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@calvin681 should we unsubscribe before doing the close?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TBH, I'm not even sure why we need to eager subscribe to the observable in call. Regardless, unsubscribing first would make more logical sense.

Comment on lines +85 to +91
@Override
public void close() throws IOException {
try {
sink.close();
} finally {
subscription.unsubscribe();
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above.

Comment on lines +92 to +96
try {
sink.close();
} finally {
subscription.unsubscribe();
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should the unsubscribe happen before sink::close?

Comment on lines +81 to +85
try {
sink.close();
} finally {
subscription.unsubscribe();
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as before.

@sundargates
Copy link
Collaborator Author

let me merge the change now. Any pending comments will be addressed in subsequent diffs.

@sundargates sundargates merged commit 3a3b5dd into Netflix:master Apr 4, 2022
sundargates added a commit to sundargates/mantis that referenced this pull request Apr 21, 2022
* [Part 9]: Introducing Sink::close

An explicit close is required because in the new model (Titus), we want the ability to stop tasks gracefully. This means shutting down all the resources that the job is currently consuming. In the old world (Apache Mesos), this was not required because we were forcefully shutting down processes which are both not clean as well as not feasible in the new world.

Co-authored-by: Sundaram Ananthanarayanan <sananthanarayanan@netflix.com>

Intermediate commit

Intermediate commit

Intermediate commit

Intermediate commit

ignoring the failing test

fixing the failing tests

Fixing failures

Adding example job jar

ignoring the failing test

everyting is there

Changing the prefixes for the configurations

ignoring tests for faster builds

Adding extra logging

Ensuring FileSystem is getting initialized

Fixing the rpc system loader for prod

Forgot to start high availability services

cleaning up

cleaning up

Adding more logs

adding some extra logs

Fixing deserialization issues

adding some extra logs

Revert "adding some extra logs"

This reverts commit 9756aa2.

formatting

Increasing certain timeouts

Cleaning up some code

Moved Ack to mantis-common

fixing formatting issues

fixing the way the rpc system is loaded in both the server and the task executor

Some fixes

updating

Revert "Disabling checkstyle errors"

This reverts commit 8af1bb1.

getting rid of check.gradle

updating actions

adding more routes

cleaning up

Making ExecuteStageRequest serializable

Cleaned up the code

fixing test

Fixing bugs in scheduler

changing the way scheduler gets used

Adding some extra logs

commit

Making sure parameter is serializable

more serializable

adding more logs

Logging

Fixing a few things

Added some tests

adding more logs

updating version

Code cleanup

updating deps

adding more logs

fixing one more thing

adding more logs

fixing one more thing

fixing one more thing

fixing one more thing

fixing one more thing

Cleaning up workerports

fixing one more thing

updating deps

updating deps

changing the source and sinks so that they close themselves cleanly

changing the ordering in which the publisher and consumer are closed

updating deps

load parent mantis classes first

moving to parent class loader

changing the thread name

getting the code to compile after rebase

fixes after rebase

local commit

minor commit

minor commit

minor commit

deleting unnecessary files

deleting unnecessary files

deleting unnecessary files

deleting unnecessary files

Updates

deleting unnecessary files

deleting unnecessary files

deleting unnecessary files

Compilation successful

getting rid of unnecessary changes

getting rid of unnecessary changes

deleting unnecessary files

deleting unnecessary files

Fixing some issues

getting rid of unnecessary changes

getting rid of unnecessary changes

Changing something

getting rid of unnecessary changes
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.

4 participants