Skip to content

Commit

Permalink
Fix cloud uptime. The uptime was still increasing even at the history…
Browse files Browse the repository at this point in the history
… server and therefore gave wrong info
  • Loading branch information
jakubhava committed May 4, 2017
1 parent 74b0153 commit 023b3c4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
Expand Up @@ -27,7 +27,7 @@ import water.H2O
class H2ORuntimeInfoUIThread(sc: SparkContext, conf : H2OConf) extends Thread{
override def run(): Unit = {
while(!Thread.interrupted()){
sc.listenerBus.post(SparkListenerH2ORuntimeUpdate(H2O.CLOUD.healthy()))
sc.listenerBus.post(SparkListenerH2ORuntimeUpdate(H2O.CLOUD.healthy(),System.currentTimeMillis()))
Thread.sleep(conf.uiUpdateInterval)
}
}
Expand Down
Expand Up @@ -77,7 +77,7 @@ case class SparklingWaterInfoPage(parent: SparklingWaterUITab) extends WebUIPage
</li>
<li>
<strong>Uptime:</strong>
{UIUtils.formatDuration(System.currentTimeMillis() - listener.h2oCloudInfo.get.h2oStartTime)}
{UIUtils.formatDuration(listener.lastTimeHeadFromH2O - listener.h2oCloudInfo.get.h2oStartTime)}
</li>
<li>
<strong>Health:</strong>{if (listener.cloudHealthy) "\u2714" else "\u2716"}
Expand Down
Expand Up @@ -33,7 +33,7 @@ case class SparkListenerH2OStart(h2oCloudInfo: H2OCloudInfo,
/**
* Update of H2O status at run-time
*/
case class SparkListenerH2ORuntimeUpdate(cloudHealthy: Boolean)
case class SparkListenerH2ORuntimeUpdate(cloudHealthy: Boolean, timeInMillis: Long)
extends SparkListenerEvent

/**
Expand All @@ -55,16 +55,19 @@ class SparklingWaterListener(conf: SparkConf) extends SparkListener with Logging
var h2oBuildInfo: Option[H2OBuildInfo] = None
var swProperties: Option[Array[(String, String)]] = None
var cloudHealthy = true
var lastTimeHeadFromH2O: Long = 0
override def onOtherEvent(event: SparkListenerEvent): Unit = event match {
case SparkListenerH2OStart(h2oCloudInfo, h2oBuildInfo, swProperties) => {
this.h2oCloudInfo = Some(h2oCloudInfo)
this.h2oBuildInfo = Some(h2oBuildInfo)
this.swProperties = Some(swProperties)
cloudHealthy = h2oCloudInfo.cloudHealthy
lastTimeHeadFromH2O = h2oCloudInfo.h2oStartTime
uiReady = true
}
case SparkListenerH2ORuntimeUpdate(cloudHealthy) => {
case SparkListenerH2ORuntimeUpdate(cloudHealthy, timeInMillis) => {
this.cloudHealthy = cloudHealthy
this.lastTimeHeadFromH2O = timeInMillis
}
case _ => // Ignore
}
Expand Down

0 comments on commit 023b3c4

Please sign in to comment.