GitHub user tdas opened a pull request:
https://github.com/apache/spark/pull/247
[SPARK-1331] Added graceful shutdown to Spark Streaming
Current version of StreamingContext.stop() directly kills all the data
receivers (NetworkReceiver) without waiting for the data already received to be
persisted and processed. This PR provides the fix. Now, when the
StreamingContext.stop() is called, the following sequence of steps will happen.
1. The driver will send a stop signal to all the active receivers.
2. Each receiver, when it gets a stop signal from the driver, first stop
receiving more data, then waits for the thread that persists data blocks to
BlockManager to finish persisting all receive data, and finally quits.
3. After all the receivers have stopped, the driver will wait for the Job
Generator and Job Scheduler to finish processing all the received data.
It also fixes the semantics of StreamingContext.start and stop. It will
throw appropriate errors and warnings if stop() is called before start(),
stop() is called twice, etc.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/tdas/spark graceful-shutdown
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/247.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #247
----
commit c43b8ae52bc0fad5e6d742800f68fde436dff5bf
Author: Tathagata Das <[email protected]>
Date: 2014-02-06T09:48:28Z
Added graceful shutdown to Spark Streaming.
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---