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
ddcb976b
Commit
ddcb976b
authored
12 years ago
by
Tathagata Das
Browse files
Options
Downloads
Patches
Plain Diff
Made MasterFailureTest more robust.
parent
4b8402e9
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
streaming/src/main/scala/spark/streaming/util/MasterFailureTest.scala
+22
-4
22 additions, 4 deletions
...c/main/scala/spark/streaming/util/MasterFailureTest.scala
with
22 additions
and
4 deletions
streaming/src/main/scala/spark/streaming/util/MasterFailureTest.scala
+
22
−
4
View file @
ddcb976b
...
...
@@ -40,6 +40,8 @@ object MasterFailureTest extends Logging {
println
(
"\n\n================= UPDATE-STATE-BY-KEY TEST =================\n\n"
)
testUpdateStateByKey
(
directory
,
numBatches
,
batchDuration
)
println
(
"\n\nSUCCESS\n\n"
)
}
def
testMap
(
directory
:
String
,
numBatches
:
Int
,
batchDuration
:
Duration
)
{
...
...
@@ -347,7 +349,8 @@ class FileGeneratingThread(input: Seq[String], testDir: Path, interval: Long)
override
def
run
()
{
val
localTestDir
=
Files
.
createTempDir
()
val
fs
=
testDir
.
getFileSystem
(
new
Configuration
())
var
fs
=
testDir
.
getFileSystem
(
new
Configuration
())
val
maxTries
=
3
try
{
Thread
.
sleep
(
5000
)
// To make sure that all the streaming context has been set up
for
(
i
<-
0
until
input
.
size
)
{
...
...
@@ -355,9 +358,24 @@ class FileGeneratingThread(input: Seq[String], testDir: Path, interval: Long)
val
localFile
=
new
File
(
localTestDir
,
(
i
+
1
).
toString
)
val
hadoopFile
=
new
Path
(
testDir
,
(
i
+
1
).
toString
)
FileUtils
.
writeStringToFile
(
localFile
,
input
(
i
).
toString
+
"\n"
)
//fs.moveFromLocalFile(new Path(localFile.toString), new Path(testDir, i.toString))
fs
.
copyFromLocalFile
(
new
Path
(
localFile
.
toString
),
hadoopFile
)
logInfo
(
"Generated file "
+
hadoopFile
+
" at "
+
System
.
currentTimeMillis
)
var
tries
=
0
var
done
=
false
while
(!
done
&&
tries
<
maxTries
)
{
tries
+=
1
try
{
fs
.
copyFromLocalFile
(
new
Path
(
localFile
.
toString
),
hadoopFile
)
done
=
true
}
catch
{
case
ioe
:
IOException
=>
{
fs
=
testDir
.
getFileSystem
(
new
Configuration
())
logWarning
(
"Attempt "
+
tries
+
" at generating file "
+
hadoopFile
+
" failed."
,
ioe
)
}
}
}
if
(!
done
)
logError
(
"Could not generate file "
+
hadoopFile
)
else
logInfo
(
"Generated file "
+
hadoopFile
+
" at "
+
System
.
currentTimeMillis
)
Thread
.
sleep
(
interval
)
localFile
.
delete
()
}
...
...
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