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

SPARK-3874, Provide stable TaskContext API #2782

Closed
wants to merge 6 commits into from

Conversation

ScrapCodes
Copy link
Member

No description provided.

@AmplabJenkins
Copy link

Can one of the admins verify this patch?

@SparkQA
Copy link

SparkQA commented Oct 13, 2014

QA tests have started for PR 2782 at commit ef633f5.

  • This patch merges cleanly.

@SparkQA
Copy link

SparkQA commented Oct 13, 2014

QA tests have finished for PR 2782 at commit ef633f5.

  • This patch fails to build.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • public abstract class TaskContext implements Serializable

@AmplabJenkins
Copy link

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/21687/
Test FAILed.

@ScrapCodes
Copy link
Member Author

Jenkins, retest this please.

@SparkQA
Copy link

SparkQA commented Oct 13, 2014

QA tests have started for PR 2782 at commit ef633f5.

  • This patch merges cleanly.

@SparkQA
Copy link

SparkQA commented Oct 13, 2014

QA tests have finished for PR 2782 at commit ef633f5.

  • This patch fails to build.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • public abstract class TaskContext implements Serializable

@AmplabJenkins
Copy link

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/21688/
Test FAILed.

@SparkQA
Copy link

SparkQA commented Oct 13, 2014

QA tests have started for PR 2782 at commit bbd9e05.

  • This patch merges cleanly.

@SparkQA
Copy link

SparkQA commented Oct 13, 2014

QA tests have finished for PR 2782 at commit bbd9e05.

  • This patch fails MiMa tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • public abstract class TaskContext implements Serializable

@AmplabJenkins
Copy link

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/21689/
Test FAILed.

@JoshRosen
Copy link
Contributor

Is there any easy way to reduce the visibility of markTaskCompleted() and the other internal methods? Could we maybe move those to TaskContextImpl and leave TaskContext as an abstract base class with no actual methods actually implemented (if I recall, we can't convert it to an interface for binary compatibility reasons)?

If we do that, you could use some tricks to cut down on the amount of boilerplate getter code code in TaskContext. In #2696, for example, I use this pattern:

Java interface / abstract base class:

public interface SparkJobInfo {
  int jobId();
  int[] stageIds();
  String status();
}

Scala implementation:

private class SparkJobInfoImpl (
  val jobId: Int,
  val stageIds: Array[Int],
  val status: String)
 extends SparkJobInfo

@@ -37,7 +37,7 @@
* Contextual information about a task which can be read or mutated during execution.
*/
@DeveloperApi
public class TaskContext implements Serializable {
public abstract class TaskContext implements Serializable {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd prefer this class not have a constructor (the whole idea here is that we don't want user to instantiate it). Basically we want to move all of the logic here to TaskContextImpl and only define the interface here in terms of abstract methods.

@pwendell
Copy link
Contributor

Hey @ScrapCodes - this is a good start, but I'd prefer to move all of the functionality into TaskContextImpl. Basically, we want TaskContext to look like an interface definition and make it so users can't construct one directly. The only reason we aren't making this a proper interface is because of compatibility reasons.

@pwendell
Copy link
Contributor

By the way - if you look at the original design I put in the JIRA, this is what it does. Thinks like markTaskCompleted should be in the Impl class.

https://issues.apache.org/jira/browse/SPARK-3874

@ScrapCodes
Copy link
Member Author

Hey Patrick, You are right about that.

We can make TaskContext an interface if we only allow TaskContextHelper.get() instead of TaskContext.get(). And then maybe I can rename TaskContextHelper to TaskContextGetter ? (Not sure !)

@pwendell
Copy link
Contributor

@ScrapCodes We cant make it a proper interface because of binary compatibility (this is a pretty widely used API so I'd prefer not to break it).

public boolean isCompleted() {
return completed;
}
public abstract boolean isCompleted();
Copy link
Contributor

Choose a reason for hiding this comment

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

//cc @rxin - should this be "isComplete" rather than "isCompleted"?

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually this looks good - we use isCompleted elsewhere already in user-facing code.

Copy link
Contributor

Choose a reason for hiding this comment

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

My understanding is that isCompleted means it has been completed, whereas isComplete means it is "whole".

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, I think isCompleted is right, since we'd use isFailed instead of isFailure or isFail.

@pwendell
Copy link
Contributor

Jenkins, test this please

@SparkQA
Copy link

SparkQA commented Oct 14, 2014

QA tests have started for PR 2782 at commit ed551ce.

  • This patch merges cleanly.

@SparkQA
Copy link

SparkQA commented Oct 14, 2014

QA tests have finished for PR 2782 at commit ed551ce.

  • This patch fails to build.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • public abstract class TaskContext implements Serializable

@AmplabJenkins
Copy link

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/21729/
Test FAILed.

@asfgit asfgit closed this in 2fe0ba9 Oct 17, 2014
@ScrapCodes ScrapCodes deleted the SPARK-3874/stable-tc branch June 3, 2015 06:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants