Skip to content

Conversation

@wgtmac
Copy link
Member

@wgtmac wgtmac commented Sep 26, 2016

What changes were proposed in this pull request?

Added a new API getApplicationInfo(appId: String) in class ApplicationHistoryProvider and class SparkUI to get app info. In this change, FsHistoryProvider can directly fetch one app info in O(1) time complexity compared to O(n) before the change which used an Iterator.find() interface.

Both ApplicationCache and OneApplicationResource classes adopt this new api.

How was this patch tested?

manual tests

Copy link
Member

@ajbozarth ajbozarth left a comment

Choose a reason for hiding this comment

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

Overall I like this addition, just a couple comments

}

def getApplicationInfo(appId: String): Option[ApplicationInfo] = {
throw new UnsupportedOperationException()
Copy link
Member

Choose a reason for hiding this comment

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

I think this would be better to return the expected result (the info if the id matches or a None if it doesn't) rather than throw an UnsupportedException, just for consistency

case Some(LoadedAppUI(ui, updateState)) =>
val completed = ui.getApplicationInfoList.exists(_.attempts.last.completed)
val completed = ui.getApplicationInfo(appId)
.map(_.attempts.last.completed).getOrElse(false)
Copy link
Member

Choose a reason for hiding this comment

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

Though I get what you're trying to do here, I'm not sure this is actually faster in this case since the list is only length one. It may be cleaner to leave this as is, what are other reviewers opinions?

Copy link
Member Author

Choose a reason for hiding this comment

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

Makes sense. I'll roll it back.

Copy link
Member

Choose a reason for hiding this comment

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

So while reviewing #15248 I think this original change actually might be better, mostly because it removes dependance both the getApplicationInfoList method that you're working with in that pr, even if it "looks" less clean.

@ajbozarth
Copy link
Member

ajbozarth commented Sep 27, 2016

If this passes tests, LGTM

@vanzin
Copy link
Contributor

vanzin commented Sep 28, 2016

ok to test

@SparkQA
Copy link

SparkQA commented Sep 28, 2016

Test build #66004 has finished for PR 15247 at commit 9feb812.

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

@SparkQA
Copy link

SparkQA commented Sep 28, 2016

Test build #66013 has finished for PR 15247 at commit 7e437a1.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

}

def getApplicationInfo(appId: String): Option[ApplicationInfo] = {
if (appId == this.appId) {
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 rather this one use the iterator.find approach to avoid duplication. It's a one item list anyway.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point. I've made this change.

@vanzin
Copy link
Contributor

vanzin commented Sep 28, 2016

One minor comment otherwise looks ok.

@SparkQA
Copy link

SparkQA commented Sep 28, 2016

Test build #66050 has finished for PR 15247 at commit 67ea2de.

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

@wgtmac
Copy link
Member Author

wgtmac commented Sep 28, 2016

Anyone knows why the last test failed in the sql module? My change has nothing to do with it.

@wgtmac wgtmac closed this Sep 28, 2016
@wgtmac wgtmac reopened this Sep 28, 2016
@ajbozarth
Copy link
Member

Jenkins, retest this please

@SparkQA
Copy link

SparkQA commented Sep 28, 2016

Test build #66059 has finished for PR 15247 at commit 67ea2de.

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

@wgtmac
Copy link
Member Author

wgtmac commented Sep 29, 2016

Another test failed in the mllib: org.apache.spark.mllib.classification.NaiveBayesSuite.Naive Bayes Multinomial

@ajbozarth Have you seen this kind of unrelated failure before? Do I have the permission to trigger the test? Thanks!

@vanzin
Copy link
Contributor

vanzin commented Sep 29, 2016

retest this please

@SparkQA
Copy link

SparkQA commented Sep 29, 2016

Test build #66110 has finished for PR 15247 at commit 67ea2de.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

/**
* Returns an ApplicationHistoryInfo for the appId.
*
* @return ApplicationHistoryInfo of one appId if exists.
Copy link
Contributor

Choose a reason for hiding this comment

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

This is kind of verbose. I would just say @return the [[ApplicationHistoryInfo]] for the appId if it exists

Copy link
Contributor

Choose a reason for hiding this comment

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

I'll fix this myself when I merge

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks!

getApplicationList().iterator.map(ApplicationsListResource.appHistoryInfoToPublicAppInfo)
}

def getApplicationInfo(appId: String): Option[ApplicationInfo] = {
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe this is a public API, but it's a reasonable one

private[spark] trait UIRoot {
def getSparkUI(appKey: String): Option[SparkUI]
def getApplicationInfoList: Iterator[ApplicationInfo]
def getApplicationInfo(appId: String): Option[ApplicationInfo]
Copy link
Contributor

Choose a reason for hiding this comment

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

also this

@andrewor14
Copy link
Contributor

LGTM merging into master 2.0, thanks.

asfgit pushed a commit that referenced this pull request Sep 29, 2016
…ngle application

Added a new API getApplicationInfo(appId: String) in class ApplicationHistoryProvider and class SparkUI to get app info. In this change, FsHistoryProvider can directly fetch one app info in O(1) time complexity compared to O(n) before the change which used an Iterator.find() interface.

Both ApplicationCache and OneApplicationResource classes adopt this new api.

 manual tests

Author: Gang Wu <wgtmac@uber.com>

Closes #15247 from wgtmac/SPARK-17671.

(cherry picked from commit cb87b3c)
Signed-off-by: Andrew Or <andrewor14@gmail.com>
@asfgit asfgit closed this in cb87b3c Sep 29, 2016
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.

5 participants