diff options
author | Karen Feng <karenfeng.us@gmail.com> | 2013-07-11 15:36:43 -0700 |
---|---|---|
committer | Karen Feng <karenfeng.us@gmail.com> | 2013-07-11 15:36:43 -0700 |
commit | fdc226a14cfdb5f699627191f1682763b8571126 (patch) | |
tree | 93e314f2e454f307c56aace23f44a05811d5e4f2 /core/src | |
parent | 5d5dbc39f603201a3596031542d52742cfb30139 (diff) | |
download | spark-fdc226a14cfdb5f699627191f1682763b8571126.tar.gz spark-fdc226a14cfdb5f699627191f1682763b8571126.tar.bz2 spark-fdc226a14cfdb5f699627191f1682763b8571126.zip |
Clarified start and end byte variable names
Diffstat (limited to 'core/src')
-rw-r--r-- | core/src/main/scala/spark/deploy/worker/ui/WorkerWebUI.scala | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/core/src/main/scala/spark/deploy/worker/ui/WorkerWebUI.scala b/core/src/main/scala/spark/deploy/worker/ui/WorkerWebUI.scala index 1fb59de1d8..2a82c35231 100644 --- a/core/src/main/scala/spark/deploy/worker/ui/WorkerWebUI.scala +++ b/core/src/main/scala/spark/deploy/worker/ui/WorkerWebUI.scala @@ -61,15 +61,13 @@ class WorkerWebUI(val worker: Worker, val workDir: File, requestedPort: Option[I val byteLength = Option(request.getParameter("byteLength")).map(_.toInt) val path = "%s/%s/%s/%s".format(workDir.getPath, appId, executorId, logType) - val offsetBytes = getByteRange(path, offset, byteLength) - val fixedOffset = offsetBytes._1 - val endOffset = offsetBytes._2 + val (startByte, endByte) = getByteRange(path, offset, byteLength) val file = new File(path) val logLength = file.length val pre = "==== Bytes %s-%s of %s of %s/%s/%s ====\n" - .format(fixedOffset, endOffset, logLength, appId, executorId, logType) - pre + Utils.offsetBytes(path, fixedOffset, endOffset) + .format(startByte, endByte, logLength, appId, executorId, logType) + pre + Utils.offsetBytes(path, startByte, endByte) } def logPage(request: HttpServletRequest): Seq[scala.xml.Node] = { @@ -80,25 +78,23 @@ class WorkerWebUI(val worker: Worker, val workDir: File, requestedPort: Option[I val byteLength = Option(request.getParameter("byteLength")).map(_.toInt) val path = "%s/%s/%s/%s".format(workDir.getPath, appId, executorId, logType) - val offsetBytes = getByteRange(path, offset, byteLength) - val fixedOffset = offsetBytes._1 - val endOffset = offsetBytes._2 + val (startByte, endByte) = getByteRange(path, offset, byteLength) val file = new File(path) val logLength = file.length - val logPageLength = endOffset-fixedOffset + val logPageLength = endByte-startByte - val logText = <node>{Utils.offsetBytes(path, fixedOffset, endOffset)}</node> + val logText = <node>{Utils.offsetBytes(path, startByte, endByte)}</node> val linkToMaster = <p><a href={worker.masterWebUiUrl}>Back to Master</a></p> - val range = <span>Bytes {fixedOffset.toString} - {endOffset.toString} of {logLength}</span> + val range = <span>Bytes {startByte.toString} - {endByte.toString} of {logLength}</span> val backButton = - if (fixedOffset > 0) { + if (startByte > 0) { <a href={"?appId=%s&executorId=%s&logType=%s&offset=%s&byteLength=%s" - .format(appId, executorId, logType, math.max(fixedOffset-logPageLength, 0), + .format(appId, executorId, logType, math.max(startByte-logPageLength, 0), logPageLength)}> - <button>Previous {math.min(logPageLength, fixedOffset)} Bytes</button> + <button>Previous {math.min(logPageLength, startByte)} Bytes</button> </a> } else { @@ -106,10 +102,10 @@ class WorkerWebUI(val worker: Worker, val workDir: File, requestedPort: Option[I } val nextButton = - if (endOffset < logLength) { + if (endByte < logLength) { <a href={"?appId=%s&executorId=%s&logType=%s&offset=%s&byteLength=%s". - format(appId, executorId, logType, endOffset, logPageLength)}> - <button>Next {math.min(logPageLength, logLength-endOffset)} Bytes</button> + format(appId, executorId, logType, endByte, logPageLength)}> + <button>Next {math.min(logPageLength, logLength-endByte)} Bytes</button> </a> } else { @@ -145,7 +141,7 @@ class WorkerWebUI(val worker: Worker, val workDir: File, requestedPort: Option[I val logLength = file.length() val getOffset = offset.getOrElse(logLength-defaultBytes) - val fixedOffset = + val startByte = if (getOffset < 0) 0L else if (getOffset > logLength) logLength else getOffset @@ -153,9 +149,9 @@ class WorkerWebUI(val worker: Worker, val workDir: File, requestedPort: Option[I val getByteLength = byteLength.getOrElse(defaultBytes) val logPageLength = math.min(getByteLength, maxBytes) - val endOffset = math.min(fixedOffset+logPageLength, logLength) + val endByte = math.min(startByte+logPageLength, logLength) - (fixedOffset, endOffset) + (startByte, endByte) } def stop() { |