Skip to content

Commit

Permalink
appSubmissionTime to appStartTime
Browse files Browse the repository at this point in the history
  • Loading branch information
turboFei committed Jan 9, 2023
1 parent 496d53f commit 30626e5
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@ private[ctl] object Render {

private def buildBatchAppInfo(batch: Batch, showDiagnostic: Boolean = true): List[String] = {
val batchAppInfo = ListBuffer[String]()
if (batch.getAppSubmissionTime > 0) {
batchAppInfo += s"App Submission Time:" +
s" ${millisToDateString(batch.getAppSubmissionTime, "yyyy-MM-dd HH:mm:ss")}"
if (batch.getAppStartTime > 0) {
batchAppInfo += s"App Start Time:" +
s" ${millisToDateString(batch.getAppStartTime, "yyyy-MM-dd HH:mm:ss")}"
}
Option(batch.getAppId).foreach { _ =>
batchAppInfo += s"App Id: ${batch.getAppId}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class Batch {
private String user;
private String batchType;
private String name;
private long appSubmissionTime;
private long appStartTime;
private String appId;
private String appUrl;
private String appState;
Expand All @@ -43,7 +43,7 @@ public Batch(
String user,
String batchType,
String name,
long appSubmissionTime,
long appStartTime,
String appId,
String appUrl,
String appState,
Expand All @@ -56,7 +56,7 @@ public Batch(
this.user = user;
this.batchType = batchType;
this.name = name;
this.appSubmissionTime = appSubmissionTime;
this.appStartTime = appStartTime;
this.appId = appId;
this.appUrl = appUrl;
this.appState = appState;
Expand Down Expand Up @@ -155,12 +155,12 @@ public void setCreateTime(long createTime) {
this.createTime = createTime;
}

public long getAppSubmissionTime() {
return appSubmissionTime;
public long getAppStartTime() {
return appStartTime;
}

public void setAppSubmissionTime(long appSubmissionTime) {
this.appSubmissionTime = appSubmissionTime;
public void setAppStartTime(long appStartTime) {
this.appStartTime = appStartTime;
}

public long getEndTime() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public void testNoPasswordBasicClient() {
assertEquals(result.getUser(), expectedBatch.getUser());
assertEquals(result.getBatchType(), expectedBatch.getBatchType());
assertEquals(result.getName(), expectedBatch.getName());
assertEquals(result.getAppSubmissionTime(), expectedBatch.getAppSubmissionTime());
assertEquals(result.getAppStartTime(), expectedBatch.getAppStartTime());
assertEquals(result.getAppId(), expectedBatch.getAppId());
assertEquals(result.getAppUrl(), expectedBatch.getAppUrl());
assertEquals(result.getAppState(), expectedBatch.getAppState());
Expand Down Expand Up @@ -146,7 +146,7 @@ public void testAnonymousBasicClient() {
assertEquals(result.getUser(), expectedBatch.getUser());
assertEquals(result.getBatchType(), expectedBatch.getBatchType());
assertEquals(result.getName(), expectedBatch.getName());
assertEquals(result.getAppSubmissionTime(), expectedBatch.getAppSubmissionTime());
assertEquals(result.getAppStartTime(), expectedBatch.getAppStartTime());
assertEquals(result.getAppId(), expectedBatch.getAppId());
assertEquals(result.getAppUrl(), expectedBatch.getAppUrl());
assertEquals(result.getAppState(), expectedBatch.getAppState());
Expand Down Expand Up @@ -178,7 +178,7 @@ public void createBatchTest() {
assertEquals(result.getUser(), expectedBatch.getUser());
assertEquals(result.getBatchType(), expectedBatch.getBatchType());
assertEquals(result.getName(), expectedBatch.getName());
assertEquals(result.getAppSubmissionTime(), expectedBatch.getAppSubmissionTime());
assertEquals(result.getAppStartTime(), expectedBatch.getAppStartTime());
assertEquals(result.getAppId(), expectedBatch.getAppId());
assertEquals(result.getAppUrl(), expectedBatch.getAppUrl());
assertEquals(result.getAppState(), expectedBatch.getAppState());
Expand Down Expand Up @@ -210,7 +210,7 @@ public void getBatchByIdTest() {
assertEquals(result.getUser(), expectedBatch.getUser());
assertEquals(result.getBatchType(), expectedBatch.getBatchType());
assertEquals(result.getName(), expectedBatch.getName());
assertEquals(result.getAppSubmissionTime(), expectedBatch.getAppSubmissionTime());
assertEquals(result.getAppStartTime(), expectedBatch.getAppStartTime());
assertEquals(result.getAppId(), expectedBatch.getAppId());
assertEquals(result.getAppUrl(), expectedBatch.getAppUrl());
assertEquals(result.getAppState(), expectedBatch.getAppState());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ class BatchJobSubmission(
private var killMessage: KillResponse = (false, "UNKNOWN")
def getKillMessage: KillResponse = killMessage

@volatile private var _appSubmissionTime = recoveryMetadata.map(_.engineOpenTime).getOrElse(0L)
def appSubmissionTime: Long = _appSubmissionTime
@volatile private var _appStartTime = recoveryMetadata.map(_.engineOpenTime).getOrElse(0L)
def appStartTime: Long = _appStartTime

@VisibleForTesting
private[kyuubi] val builder: ProcBuilder = {
Expand All @@ -102,8 +102,8 @@ class BatchJobSubmission(
val applicationInfo =
applicationManager.getApplicationInfo(builder.clusterManager(), batchId).filter(_.id != null)
applicationInfo.foreach { _ =>
if (_appSubmissionTime <= 0) {
_appSubmissionTime = System.currentTimeMillis()
if (_appStartTime <= 0) {
_appStartTime = System.currentTimeMillis()
}
}
applicationInfo
Expand Down Expand Up @@ -137,7 +137,7 @@ class BatchJobSubmission(
val metadataToUpdate = Metadata(
identifier = batchId,
state = state.toString,
engineOpenTime = appSubmissionTime,
engineOpenTime = appStartTime,
engineId = status.id,
engineName = status.name,
engineUrl = status.url.orNull,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ private[v1] class BatchesResource extends ApiRequestContext with Logging {
session.user,
batchOp.batchType,
name,
batchOp.appSubmissionTime,
batchOp.appStartTime,
appId,
appUrl,
appState,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ class KyuubiBatchSessionImpl(

private[kyuubi] def onEngineOpened(): Unit = {
if (sessionEvent.openedTime <= 0) {
sessionEvent.openedTime = batchJobSubmissionOp.appSubmissionTime
sessionEvent.openedTime = batchJobSubmissionOp.appStartTime
EventBus.post(sessionEvent)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class BatchesResourceSuite extends KyuubiFunSuite with RestFrontendTestHelper wi
assert(batch.getCreateTime > 0)
assert(batch.getEndTime === 0)
if (batch.getAppId != null) {
assert(batch.getAppSubmissionTime > 0)
assert(batch.getAppStartTime > 0)
}

// invalid batchId
Expand Down

0 comments on commit 30626e5

Please sign in to comment.