Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
spark
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cs525-sp18-g07
spark
Commits
9ed036cc
Commit
9ed036cc
authored
11 years ago
by
Karen Feng
Browse files
Options
Downloads
Patches
Plain Diff
Replaced logPageLength with byteLength to prevent buffer shrink bug
parent
fdc226a1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/src/main/scala/spark/deploy/worker/ui/WorkerWebUI.scala
+12
-11
12 additions, 11 deletions
core/src/main/scala/spark/deploy/worker/ui/WorkerWebUI.scala
with
12 additions
and
11 deletions
core/src/main/scala/spark/deploy/worker/ui/WorkerWebUI.scala
+
12
−
11
View file @
9ed036cc
...
...
@@ -54,11 +54,12 @@ class WorkerWebUI(val worker: Worker, val workDir: File, requestedPort: Option[I
}
def
log
(
request
:
HttpServletRequest
)
:
String
=
{
val
defaultBytes
=
10000
val
appId
=
request
.
getParameter
(
"appId"
)
val
executorId
=
request
.
getParameter
(
"executorId"
)
val
logType
=
request
.
getParameter
(
"logType"
)
val
offset
=
Option
(
request
.
getParameter
(
"offset"
)).
map
(
_
.
toLong
)
val
byteLength
=
Option
(
request
.
getParameter
(
"byteLength"
)).
map
(
_
.
toInt
)
val
byteLength
=
Option
(
request
.
getParameter
(
"byteLength"
)).
map
(
_
.
toInt
)
.
getOrElse
(
defaultBytes
)
val
path
=
"%s/%s/%s/%s"
.
format
(
workDir
.
getPath
,
appId
,
executorId
,
logType
)
val
(
startByte
,
endByte
)
=
getByteRange
(
path
,
offset
,
byteLength
)
...
...
@@ -71,17 +72,18 @@ class WorkerWebUI(val worker: Worker, val workDir: File, requestedPort: Option[I
}
def
logPage
(
request
:
HttpServletRequest
)
:
Seq
[
scala.xml.Node
]
=
{
val
defaultBytes
=
10000
val
appId
=
request
.
getParameter
(
"appId"
)
val
executorId
=
request
.
getParameter
(
"executorId"
)
val
logType
=
request
.
getParameter
(
"logType"
)
val
offset
=
Option
(
request
.
getParameter
(
"offset"
)).
map
(
_
.
toLong
)
val
byteLength
=
Option
(
request
.
getParameter
(
"byteLength"
)).
map
(
_
.
toInt
)
val
byteLength
=
Option
(
request
.
getParameter
(
"byteLength"
)).
map
(
_
.
toInt
)
.
getOrElse
(
defaultBytes
)
val
path
=
"%s/%s/%s/%s"
.
format
(
workDir
.
getPath
,
appId
,
executorId
,
logType
)
val
(
startByte
,
endByte
)
=
getByteRange
(
path
,
offset
,
byteLength
)
val
file
=
new
File
(
path
)
val
logLength
=
file
.
length
val
logPageLength
=
endByte
-
startByte
//
val logPageLength = endByte-startByte
val
logText
=
<
node
>{
Utils
.
offsetBytes
(
path
,
startByte
,
endByte
)}</
node
>
...
...
@@ -92,9 +94,9 @@ class WorkerWebUI(val worker: Worker, val workDir: File, requestedPort: Option[I
val
backButton
=
if
(
startByte
>
0
)
{
<
a
href
={
"?appId=%s&executorId=%s&logType=%s&offset=%s&byteLength=%s"
.
format
(
appId
,
executorId
,
logType
,
math
.
max
(
startByte
-
logPag
eLength
,
0
),
logPag
eLength
)}>
<
button
>
Previous
{
math
.
min
(
logPag
eLength
,
startByte
)}
Bytes
</
button
>
.
format
(
appId
,
executorId
,
logType
,
math
.
max
(
startByte
-
byt
eLength
,
0
),
byt
eLength
)}>
<
button
>
Previous
{
math
.
min
(
byt
eLength
,
startByte
)}
Bytes
</
button
>
</
a
>
}
else
{
...
...
@@ -104,8 +106,8 @@ class WorkerWebUI(val worker: Worker, val workDir: File, requestedPort: Option[I
val
nextButton
=
if
(
endByte
<
logLength
)
{
<
a
href
={
"?appId=%s&executorId=%s&logType=%s&offset=%s&byteLength=%s"
.
format
(
appId
,
executorId
,
logType
,
endByte
,
logPag
eLength
)}>
<
button
>
Next
{
math
.
min
(
logPag
eLength
,
logLength
-
endByte
)}
Bytes
</
button
>
format
(
appId
,
executorId
,
logType
,
endByte
,
byt
eLength
)}>
<
button
>
Next
{
math
.
min
(
byt
eLength
,
logLength
-
endByte
)}
Bytes
</
button
>
</
a
>
}
else
{
...
...
@@ -132,7 +134,7 @@ class WorkerWebUI(val worker: Worker, val workDir: File, requestedPort: Option[I
}
/** Determine the byte range for a log or log page. */
def
getByteRange
(
path
:
String
,
offset
:
Option
[
Long
],
byteLength
:
Option
[
Int
]
)
def
getByteRange
(
path
:
String
,
offset
:
Option
[
Long
],
byteLength
:
Int
)
:
(
Long
,
Long
)
=
{
val
defaultBytes
=
10000
val
maxBytes
=
1024
*
1024
...
...
@@ -146,8 +148,7 @@ class WorkerWebUI(val worker: Worker, val workDir: File, requestedPort: Option[I
else
if
(
getOffset
>
logLength
)
logLength
else
getOffset
val
getByteLength
=
byteLength
.
getOrElse
(
defaultBytes
)
val
logPageLength
=
math
.
min
(
getByteLength
,
maxBytes
)
val
logPageLength
=
math
.
min
(
byteLength
,
maxBytes
)
val
endByte
=
math
.
min
(
startByte
+
logPageLength
,
logLength
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment