-
Notifications
You must be signed in to change notification settings - Fork 28.9k
[SPARK-3626] [WIP] Replace AsyncRDDActions with a more general runAsync() mechanism #2482
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
Conversation
|
QA tests have started for PR 2482 at commit
|
|
QA tests have finished for PR 2482 at commit
|
|
I don't think we can just wipe the old one out. At the very least, we need to "deprecate" it. Even that is debatable because some applications might prefer this async model. |
|
QA tests have started for PR 2482 at commit
|
|
+1 @rxin Just scanned through the code quickly, and I didn't immediately see anything that would preclude retaining and deprecating the old code while introducing the new (which looks pretty good!) |
|
Fair enough, although the
On the other hand, the individual methods weren't marked as |
|
Yes, I know that they are now Experimental, but they weren't always so, since we didn't have the Experimental designation/policy when AsyncRDDActions was introduced. And even though we can remove the old code without violating policy, we should recognize that any user code that is using the old code is likely to require non-trivial changes to confidently move to the new style code. Deprecation makes sense even if it's not strictly required. |
|
@rxin Do you have any examples of why a user might prefer the old model, besides backwards-compatibility? I'd like to understand if the old model (in its current form) provides any features that this proposal is missing (so that I can add them). |
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.
note that this is not a reliable (actually very unreliable) way of cancelling a thread.
this only stops the thread if it is waiting on io or sleeping. if the user thread is actually executing stuff (or busy looping), this doesn't do anything.
|
QA tests have finished for PR 2482 at commit
|
3171939 to
4882082
Compare
|
QA tests have started for PR 2482 at commit
|
|
I've taken another pass at this. This time, I kept AsyncRDDActions but re-implemented it using I'm beginning to get the sense that we might not have much room to change anything about the implementation of AsyncRDDActions, so maybe we should just let them be. @rxin Based on our discussion, I added a check in DAGScheduler to reject jobs submitted by cancelled threads. |
|
QA tests have finished for PR 2482 at commit
|
|
I'm going to close this for now. My approach has some confusing semantics and may be more general than what most users need. |
Background
The
AsyncRDDActionsmethods were introduced in e33b183, the first pull request to add support for job cancelation. A follow pull request, 599dcb0, added cancelation on a per-job-group basis. Quoting from that PR:In its current form,
AsyncRDDActionsseems to serve no purpose other than to enable job cancelation.AsyncRDDActionsis marked as@Experimental, so users may be reluctant to depend on it. If we add new actions, then we also have to add asynchronous versions of those actions, creating a maintenance burden.Proposal
I propose that we remove
AsyncRDDActionsand use job groups as the only user-facing API for job cancelation. To make job groups more convenient for users, this pull request adds arunAsyncmethod to SparkContext that makes it easy to run an asynchronous computation in a particular Spark job group. For example:I refactored
JobCancellationSuiteto use this new API instead of AsyncRDDActions; see that file for more examples.TODOS / tasks to finish before merging:
This is marked as [WIP] since there are still a number of tasks that need to be finished before this is merge-worthy:
Runnable.RunAsyncResultto expose the job ids of jobs launched from its computation (see SPARK-3446 / [SPARK-3446] Expose underlying job ids in FutureAction. #2337).