Skip to content

SPARK-3014. Log a more informative messages in a couple failure scenario... #1934

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

Closed
wants to merge 1 commit into from

Conversation

sryza
Copy link
Contributor

@sryza sryza commented Aug 14, 2014

...s

@SparkQA
Copy link

SparkQA commented Aug 14, 2014

QA tests have started for PR 1934. This patch merges cleanly.
View progress: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/18495/consoleFull

}

uiAddress = sparkContext.ui.appUIHostPort
Copy link
Contributor

Choose a reason for hiding this comment

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

Won't this throw an NPE if sparkContext == null? Also, it seems that this whole code block assumes sparkContext is not null, which may not be true. Maybe we should put this code block in an else case.

Copy link
Contributor

Choose a reason for hiding this comment

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

I just realized, even in the old code it's bound to throw an NPE if sparkContext == null, because we access it in L236 of the old code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point. I thought finishApplicationMaster actually handled the shutdown so we wouldn't get past there. Fixing this.

@andrewor14
Copy link
Contributor

Tests actually passed, just not posted here

@sryza
Copy link
Contributor Author

sryza commented Aug 14, 2014

Updated patch fixes an issue that @andrewor14 pointed out.


if (sparkContext != null) {
if (sparkContext == null) {
logError(("Unable to retrieve SparkContext in spite of waiting for %d, maxNumTries = %d."
Copy link
Contributor

Choose a reason for hiding this comment

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

This language is quite specific to the internal implementation and might be a bit confusing for users. For instance, what does it mean to "retrieve" a SparkContext? It might be better to make it more consistent with the language in the two other log statements and say something like:

Spark context did not initialize properly after waiting for XXX.
Please check earlier log output for errors. Failing the application.

Also - I don't think this will print a unit for the wait time. I believe the unit is ms so it might be good to add that.

@pwendell
Copy link
Contributor

Hey @sryza - left a minor comment on language, but this looks good overall.

@andrewor14
Copy link
Contributor

test this please

@SparkQA
Copy link

SparkQA commented Aug 18, 2014

QA tests have started for PR 1934 at commit d77bd52.

  • This patch merges cleanly.

@SparkQA
Copy link

SparkQA commented Aug 18, 2014

QA tests have finished for PR 1934 at commit d77bd52.

  • This patch fails unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@andrewor14
Copy link
Contributor

test this please

@SparkQA
Copy link

SparkQA commented Aug 18, 2014

QA tests have started for PR 1934 at commit 36eb7db.

  • This patch merges cleanly.

@SparkQA
Copy link

SparkQA commented Aug 18, 2014

QA tests have finished for PR 1934 at commit 36eb7db.

  • This patch passes unit tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • throw new IllegalStateException("The main method in the given main class must be static")
    • case class OutputFaker(output: Seq[Attribute], child: SparkPlan) extends SparkPlan
    • implicit class LogicalPlanHacks(s: SchemaRDD)
    • implicit class PhysicalPlanHacks(originalPlan: SparkPlan)
    • class FakeParquetSerDe extends SerDe

@JoshRosen
Copy link
Contributor

Hey @sryza,

This looks like a good change; sorry for allowing it to sit unreviewed for so long. Do you mind updating this to address the merge conflicts?

@SparkQA
Copy link

SparkQA commented Sep 2, 2014

QA tests have started for PR 1934 at commit ae19cc1.

  • This patch merges cleanly.

@SparkQA
Copy link

SparkQA commented Sep 2, 2014

QA tests have finished for PR 1934 at commit ae19cc1.

  • This patch passes unit tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • throw new IllegalStateException("The main method in the given main class must be static")

@@ -270,11 +270,9 @@ private[spark] class ApplicationMaster(args: ApplicationMasterArguments,
}

val sparkContext = sparkContextRef.get()
assert(sparkContext != null || count >= numTries)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why did you remove this assertion?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If the assertion fails, it's a consequence of user error, not a logic error in Spark's code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops, actually misread it. Will add it back in.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

On third thought, I don't really think the assert is useful. Adding it back in would require adding "|| finished", which basically makes it look exactly the same as the while loop condition above. It doesn't make the code any easier to understand.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree. This assertion technically had a chance to fail before, if we haven't incremented count all the way and finished becomes true, and the assertion failure is meaningless.

@tgravescs
Copy link
Contributor

@JoshRosen any other comments on this

@JoshRosen
Copy link
Contributor

This looks good to me. I tested spark-submit with both Scala and Java examples and the error-free cases still work correctly. I also modified SparkPi so that the main() method wasn't static and verified that it gives the new error message.

@tgravescs
Copy link
Contributor

Jenkins, test this please

@andrewor14
Copy link
Contributor

retest this please

@SparkQA
Copy link

SparkQA commented Sep 12, 2014

QA tests have started for PR 1934 at commit ae19cc1.

  • This patch merges cleanly.

@SparkQA
Copy link

SparkQA commented Sep 12, 2014

QA tests have finished for PR 1934 at commit ae19cc1.

  • This patch passes unit tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • throw new IllegalStateException("The main method in the given main class must be static")

@andrewor14
Copy link
Contributor

Alright, LGTM. Feel free to merge this.

@asfgit asfgit closed this in 1d76796 Sep 12, 2014
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.

6 participants