Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
59bf9e1
[SPARK-5931] Updated Utils and JavaUtils classes to add helper method…
Mar 27, 2015
404f8c3
Updated usage of spark.core.connection.ack.wait.timeout
Mar 27, 2015
7db6d2a
Updated usage of spark.akka.timeout
Mar 27, 2015
4933fda
Updated usage of spark.storage.blockManagerSlaveTimeout
Mar 27, 2015
c9f5cad
Updated spark.shuffle.io.retryWait
Mar 27, 2015
21ef3dd
updated spark.shuffle.sasl.timeout
Mar 27, 2015
064ebd6
Updated usage of spark.cleaner.ttl
Mar 27, 2015
7320c87
updated spark.akka.heartbeat.interval
Mar 27, 2015
272c215
Updated spark.locality.wait
Mar 27, 2015
3352d34
Updated spark.scheduler.maxRegisteredResourcesWaitingTime
Mar 27, 2015
3f1cfc8
Updated spark.scheduler.revive.interval
Mar 27, 2015
6d1518e
Upated spark.speculation.interval
Mar 27, 2015
2fcc91c
Updated spark.dynamicAllocation.executorIdleTimeout
Mar 27, 2015
5181597
Updated spark.dynamicAllocation.schedulerBacklogTimeout
Mar 27, 2015
c6a0095
Updated spark.core.connection.auth.wait.timeout
Mar 27, 2015
cde9bff
Updated spark.streaming.blockInterval
Mar 27, 2015
42477aa
Updated configuration doc with note on specifying time properties
Mar 27, 2015
9a29d8d
Fixed misuse of time in streaming context test
Mar 27, 2015
34f87c2
Update Utils.scala
ilganeli Mar 28, 2015
8f741e1
Update JavaUtils.java
ilganeli Mar 28, 2015
9e2547c
Reverting doc changes
Mar 30, 2015
499bdf0
Merge branch 'SPARK-5931' of github.com:ilganeli/spark into SPARK-5931
Mar 30, 2015
5232a36
[SPARK-5931] Changed default behavior of time string conversion.
Mar 30, 2015
3a12dd8
Updated host revceiver
Mar 30, 2015
68f4e93
Updated more files to clean up usage of default time strings
Mar 30, 2015
70ac213
Fixed remaining usages to be consistent. Updated Java-side time conve…
Mar 30, 2015
647b5ac
Udpated time conversion to use map iterator instead of if fall through
Mar 31, 2015
1c0c07c
Updated Java code to add day, minutes, and hours
Mar 31, 2015
8613631
Whitespace
Mar 31, 2015
bac9edf
More whitespace
Mar 31, 2015
1858197
Fixed bug where all time was being converted to us instead of the app…
Mar 31, 2015
3b126e1
Fixed conversion to US from seconds
Mar 31, 2015
39164f9
[SPARK-5931] Updated Java conversion to be similar to scala conversio…
Mar 31, 2015
b2fc965
replaced get or default since it's not present in this version of java
Mar 31, 2015
dd0a680
Updated scala code to call into java
Mar 31, 2015
bf779b0
Special handling of overlapping usffixes for java
Apr 1, 2015
76cfa27
[SPARK-5931] Minor nit fixes'
Apr 1, 2015
5193d5f
Resolved merge conflicts
Apr 6, 2015
6387772
Updated suffix handling to handle overlap of units more gracefully
Apr 6, 2015
19c31af
Added cleaner computation of time conversions in tests
Apr 6, 2015
ff40bfe
Updated tests to fix small bugs
Apr 6, 2015
28187bf
Convert straight to seconds
Apr 6, 2015
1465390
Nit
Apr 6, 2015
cbf41db
Got rid of thrown exceptions
Apr 7, 2015
d4efd26
Added time conversion for yarn.scheduler.heartbeat.interval-ms
Apr 8, 2015
4e48679
Fixed priority order and mixed up conversions in a couple spots
Apr 8, 2015
1a1122c
Formatting fixes and added m for use as minute formatter
Apr 8, 2015
cbd2ca6
Formatting error
Apr 8, 2015
6f651a8
Now using regexes to simplify code in parseTimeString. Introduces get…
Apr 8, 2015
7d19cdd
Added fix for possible NPE
Apr 8, 2015
dc7bd08
Fixed error in exception handling
Apr 8, 2015
69fedcc
Added test for zero
Apr 8, 2015
8927e66
Fixed handling of -1
Apr 9, 2015
642a06d
Fixed logic for invalid suffixes and addid matching test
Apr 9, 2015
25d3f52
Minor nit fixes
Apr 11, 2015
bc04e05
Minor fixes and doc updates
Apr 13, 2015
951ca2d
Made the most recent round of changes
Apr 13, 2015
f5fafcd
Doc updates
Apr 13, 2015
de3bff9
Fixing style errors
Apr 13, 2015
4526c81
Update configuration.md
Apr 13, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[SPARK-5931] Changed default behavior of time string conversion.
  • Loading branch information
Ilya Ganelin committed Mar 30, 2015
commit 5232a36f660022f87b3a8c68a8aa4b514d57fbb1
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,15 @@ private[spark] class ExecutorAllocationManager(
Integer.MAX_VALUE)

// How long there must be backlogged tasks for before an addition is triggered (seconds)
private val schedulerBacklogTimeoutS = Utils.timeStringToS(conf.get(
private val schedulerBacklogTimeoutS = Utils.timeStringAsS(conf.get(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very minor, but in general I find it weird for variables to have a capital letter at the end. I would call this either schedulerBacklogTimeoutSeconds or just leave it as before. From the comments it's pretty clear that all these configs are in seconds. Not a big deal if you don't change this.

"spark.dynamicAllocation.schedulerBacklogTimeoutS", "5s"))

// Same as above, but used only after `schedulerBacklogTimeoutS` is exceeded
private val sustainedSchedulerBacklogTimeoutS = Utils.timeStringToS(conf.get(
private val sustainedSchedulerBacklogTimeoutS = Utils.timeStringAsS(conf.get(
"spark.dynamicAllocation.sustainedSchedulerBacklogTimeoutS", s"${schedulerBacklogTimeoutS}s"))

// How long an executor must be idle for before it is removed (seconds)
private val executorIdleTimeoutS = Utils.timeStringToS(conf.get(
private val executorIdleTimeoutS = Utils.timeStringAsS(conf.get(
"spark.dynamicAllocation.executorIdleTimeoutS", "600s"))

// During testing, the methods to actually kill and add executors are mocked out
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/scala/org/apache/spark/HeartbeatReceiver.scala
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ private[spark] class HeartbeatReceiver(sc: SparkContext, scheduler: TaskSchedule
// executor ID -> timestamp of when the last heartbeat from this executor was received
private val executorLastSeen = new mutable.HashMap[String, Long]

private val executorTimeoutMs = Utils.timeStringToMs(sc.conf.get("spark.network.timeout",
private val executorTimeoutMs = Utils.timeStringAsMs(sc.conf.get("spark.network.timeout",
sc.conf.get("spark.storage.blockManagerSlaveTimeout", "120s")))

// "spark.network.timeoutInterval" uses "seconds", while
// "spark.storage.blockManagerTimeoutIntervalMs" uses "milliseconds"
private val checkTimeoutIntervalMs = Utils.timeStringToMs(
private val checkTimeoutIntervalMs = Utils.timeStringAsMs(
sc.conf.get("spark.network.timeoutInterval",
sc.conf.get("spark.storage.blockManagerTimeoutIntervalMs", "60s")))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ private[spark] class Executor(
* This thread stops running when the executor is stopped.
*/
private def startDriverHeartbeater(): Unit = {
val intervalMs = Utils.timeStringToMs(conf.get("spark.executor.heartbeatInterval", "10s"))
val intervalMs = Utils.timeStringAsMs(conf.get("spark.executor.heartbeatInterval", "10s"))
val thread = new Thread() {
override def run() {
// Sleep a random intervalMs so the heartbeats don't end up in sync
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the "interval" here was referring to the variable, so could you please revert this :)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ private[nio] class ConnectionManager(
new HashedWheelTimer(Utils.namedThreadFactory("AckTimeoutMonitor"))

private val ackTimeout =
Utils.timeStringToS(conf.get("spark.core.connection.ack.wait.timeout",
Utils.timeStringAsS(conf.get("spark.core.connection.ack.wait.timeout",
conf.get("spark.network.timeout", "120s")))

// Get the thread counts from the Spark Configuration.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ private[spark] class TaskSchedulerImpl(

// How often to check for speculative tasks
val SPECULATION_INTERVAL_MS =
Utils.timeStringToMs(conf.get("spark.speculation.interval", "100ms"))
Utils.timeStringAsMs(conf.get("spark.speculation.interval", "100ms"))

// Threshold above which we warn user initial TaskSet may be starved
val STARVATION_TIMEOUT_MS = Utils.timeStringToMs(conf.get("spark.starvation.timeout", "15000ms"))
val STARVATION_TIMEOUT_MS = Utils.timeStringAsMs(conf.get("spark.starvation.timeout", "15000ms"))

// CPUs to request per task
val CPUS_PER_TASK = conf.getInt("spark.task.cpus", 1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -851,11 +851,11 @@ private[spark] class TaskSetManager(
val defaultWait = conf.get("spark.locality.wait", "3000ms")
level match {
case TaskLocality.PROCESS_LOCAL =>
Utils.timeStringToMs(conf.get("spark.locality.wait.process", defaultWait))
Utils.timeStringAsMs(conf.get("spark.locality.wait.process", defaultWait))
case TaskLocality.NODE_LOCAL =>
Utils.timeStringToMs(conf.get("spark.locality.wait.node", defaultWait))
Utils.timeStringAsMs(conf.get("spark.locality.wait.node", defaultWait))
case TaskLocality.RACK_LOCAL =>
Utils.timeStringToMs(conf.get("spark.locality.wait.rack", defaultWait))
Utils.timeStringAsMs(conf.get("spark.locality.wait.rack", defaultWait))
case _ => 0L
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just an idea, maybe we can rewrite this as:

val defaultWait = conf.get("spark.locality.wait", "3s")
val localityWaitKey =
  key match {
    case TaskLocality.PROCESS_LOCAL => "spark.locality.wait.process"
    case TaskLocality.NODE_LOCAL => "spark.locality.wait.node"
    case TaskLocality.RACK_LOCAL => "spark.locality.wait.rack"
  }
Utils.timeStringAsMs(conf.get(localityWaitKey, defaultWait))

Looks nicer IMO, less duplicate code

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class CoarseGrainedSchedulerBackend(scheduler: TaskSchedulerImpl, val actorSyste
// Submit tasks after maxRegisteredWaitingTime milliseconds
// if minRegisteredRatio has not yet been reached
val maxRegisteredWaitingTimeMs =
Utils.timeStringToMs(conf.get("spark.scheduler.maxRegisteredResourcesWaitingTime", "30000ms"))
Utils.timeStringAsMs(conf.get("spark.scheduler.maxRegisteredResourcesWaitingTime", "30000ms"))
val createTime = System.currentTimeMillis()

private val executorDataMap = new HashMap[String, ExecutorData]
Expand All @@ -80,7 +80,7 @@ class CoarseGrainedSchedulerBackend(scheduler: TaskSchedulerImpl, val actorSyste
context.system.eventStream.subscribe(self, classOf[RemotingLifecycleEvent])

// Periodically revive offers to allow delay scheduling to work
val reviveIntervalMs = Utils.timeStringToMs(
val reviveIntervalMs = Utils.timeStringAsMs(
conf.get("spark.scheduler.revive.interval", "1000ms"))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose you can say "1s" but it's not that important

import context.dispatcher
context.system.scheduler.schedule(0.millis, reviveIntervalMs.millis, self, ReviveOffers)
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/scala/org/apache/spark/util/AkkaUtils.scala
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ private[spark] object AkkaUtils extends Logging {

val akkaThreads = conf.getInt("spark.akka.threads", 4)
val akkaBatchSize = conf.getInt("spark.akka.batchSize", 15)
val akkaTimeoutS = Utils.timeStringToS(conf.get("spark.akka.timeout",
val akkaTimeoutS = Utils.timeStringAsS(conf.get("spark.akka.timeout",
conf.get("spark.network.timeout", "120s")))
val akkaFrameSize = maxFrameSizeBytes(conf)
val akkaLogLifecycleEvents = conf.getBoolean("spark.akka.logLifecycleEvents", false)
Expand All @@ -81,7 +81,7 @@ private[spark] object AkkaUtils extends Logging {

val akkaHeartBeatPauses = conf.getInt("spark.akka.heartbeat.pauses", 6000)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is also a time property in seconds.

val akkaHeartBeatIntervalS =
Utils.timeStringToS(conf.get("spark.akka.heartbeat.interval", "1000s"))
Utils.timeStringAsS(conf.get("spark.akka.heartbeat.interval", "1000s"))

val secretKey = securityManager.getSecretKey()
val isAuthOn = securityManager.isAuthenticationEnabled()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ private[spark] object MetadataCleanerType extends Enumeration {
// initialization of StreamingContext. It's okay for users trying to configure stuff themselves.
private[spark] object MetadataCleaner {
def getDelaySeconds(conf: SparkConf): Int = {
Utils.timeStringToS(conf.get("spark.cleaner.ttl", "-1s")).toInt
Utils.timeStringAsS(conf.get("spark.cleaner.ttl", "-1s")).toInt
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-1s looks really weird. Instead, I'd to:

conf.getOption("spark.cleaner.ttl").map(Utils.timeStringAsS).getOrElse(-1)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can just make it -1 as it was before. The function will assume it's a seconds.

}

def getDelaySeconds(
Expand Down
62 changes: 42 additions & 20 deletions core/src/main/scala/org/apache/spark/util/Utils.scala
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@ private[spark] object Utils extends Logging {
}
Utils.setupSecureURLConnection(uc, securityMgr)

val timeoutMs = Utils.timeStringToMs(conf.get("spark.files.fetchTimeout", "60s")).toInt
val timeoutMs = Utils.timeStringAsMs(conf.get("spark.files.fetchTimeout", "60s")).toInt
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a question -- do you support "1m"? I can't decide whether that's better than "60s". Kind of reads like "1 megabyte" or something unless it's "1min". Either way seems OK.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to leave it as 1min for clarity for that reason.

uc.setConnectTimeout(timeoutMs)
uc.setReadTimeout(timeoutMs)
uc.connect()
Expand Down Expand Up @@ -1010,36 +1010,58 @@ private[spark] object Utils extends Logging {
)
}

/** Check whether a time-suffix was provided for the time string. */
private def hasTimeSuffix(str: String) : Boolean = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not used anywhere.

val lower = str.toLowerCase.trim()
lower.endsWith("ms") || lower.endsWith("us") || lower.endsWith("s")
}

val timeError = "Time must be specified as seconds (s), " +
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I'd declare this where it's used.

"milliseconds (ms), or microseconds (us) e.g. 50s, 100ms, or 250us."

/**
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: add empty line before comment start

* Convert a time parameter such as (50s, 100ms, or 250us) to microseconds for internal use
* Convert a passed time string (e.g. 50s, 100ms, or 250us) to a microsecond count for
* internal use. If no suffix is provided a direct conversion is attempted.
*/
def timeStringToUs(str: String): Long = {
val lower = str.toLowerCase.trim()
if (lower.endsWith("ms")) {
lower.substring(0, lower.length-2).toLong * 1000
} else if (lower.endsWith("us")) {
lower.substring(0, lower.length-2).toLong
} else if (lower.endsWith("s")) {
lower.substring(0, lower.length-1).toLong * 1000 * 1000
} else { // Invalid suffix, force correct formatting
throw new IllegalArgumentException("Time must be specified as seconds (s), " +
"milliseconds (ms), or microseconds (us) e.g. 50s, 100ms, or 250us.")
private def timeStringToUs(str: String) : Long = {
try {
val lower = str.toLowerCase.trim()
if (lower.endsWith("ms")) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd add at least min, h and d as valid suffixes here. Also, something like this might be easier to code for:

val suffixes = Map(
  "us" -> 1,
  "ms" -> 1000,
  "s" -> 1000 * 1000,
  "min" -> 60 * 1000 * 1000,
  "h" -> 60 * 60 * 1000 * 1000,
  // etc

Then you can iterate over the map instead of having cascading if / else checks.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, you could also use java.util.concurrent.TimeUnit here:

val suffixes = Map(
  "us" -> TimeUnit.MICROSECONDS,
  "ms" -> TimeUnit.MILLISECONDS,
  // etc

val us = suffixes(suffix).toMicros(value)

You could then use the same map in other conversions if you really want to:

def timeStrAsHours(value: String) = TimeUnit.MICROSECONDS.toHours(timStringToUs(value))

lower.substring(0, lower.length - 2).toLong * 1000
} else if (lower.endsWith("us")) {
lower.substring(0, lower.length - 2).toLong
} else if (lower.endsWith("s")) {
lower.substring(0, lower.length - 1).toLong * 1000 * 1000
} else {
// Invalid suffix, force correct formatting
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really "invalid suffix", right? This is just handling the case where a suffix is not expected. If there is an invalid suffix, then an exception will be thrown.

lower.toLong
}
} catch {
case e: NumberFormatException => throw new NumberFormatException(timeError)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should also propagate the original error message. It might be the case that the error has nothing to do with the lack of a suffix (e.g. 1!11ms).

}
}

/**
* Convert a time parameter such as (50s, 100ms, or 250us) to milliseconds for internal use.
* Note: may round in some cases
* Convert a time parameter such as (50s, 100ms, or 250us) to microseconds for internal use. If
* no suffix is provided, the passed number is assumed to be in us.
*/
def timeStringAsUs(str: String): Long = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are the microseconds methods used anywhere? I'm not aware of anything that uses this resolution, but might have missed it. There aren't us methods in SparkConf.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No - they can be removed.

timeStringToUs(str)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: too much indentation (here and in other places too)

}

/**
* Convert a time parameter such as (50s, 100ms, or 250us) to microseconds for internal use. If
* no suffix is provided, the passed number is assumed to be in ms.
*/
def timeStringToMs(str : String) : Long = {
timeStringToUs(str)/1000
def timeStringAsMs(str : String) : Long = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no space before :

timeStringToUs(str)/1000
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: spaces between / (here and elsewhere)

}

/**
* Convert a time parameter such as (50s, 100ms, or 250us) to seconds for internal use.
* Note: may round in some cases
* Convert a time parameter such as (50s, 100ms, or 250us) to microseconds for internal use. If
* no suffix is provided, the passed number is assumed to be in seconds.
*/
def timeStringToS(str : String) : Long = {
def timeStringAsS(str : String) : Long = {
timeStringToUs(str)/1000/1000
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ class TaskSetManagerSuite extends FunSuite with LocalSparkContext with Logging {

private val conf = new SparkConf

val LOCALITY_WAIT = Utils.timeStringToMs(conf.get("spark.locality.wait", "3000ms"))
val LOCALITY_WAIT = Utils.timeStringAsMs(conf.get("spark.locality.wait", "3000ms"))
val MAX_TASK_FAILURES = 4

override def beforeEach() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ private[streaming] class BlockGenerator(

private val clock = new SystemClock()
private val blockIntervalMs =
Utils.timeStringToMs(conf.get("spark.streaming.blockIntervalMs", "200ms"))
Utils.timeStringAsMs(conf.get("spark.streaming.blockIntervalMs", "200ms"))
private val blockIntervalTimer =
new RecurringTimer(clock, blockIntervalMs, updateCurrentBuffer, "BlockGenerator")
private val blockQueueSize = conf.getInt("spark.streaming.blockQueueSize", 10)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class JobGenerator(jobScheduler: JobScheduler) extends Logging {
if (processReceivedData) {
logInfo("Stopping JobGenerator gracefully")
val timeWhenStopStarted = System.currentTimeMillis()
val stopTimeout = Utils.timeStringToMs(conf.get(
val stopTimeout = Utils.timeStringAsMs(conf.get(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could have "MS" on the end?

"spark.streaming.gracefulStopTimeout", s"${10 * ssc.graph.batchDuration.milliseconds}ms"))
val pollTime = 100

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class StreamingContextSuite extends FunSuite with BeforeAndAfter with Timeouts w
val myConf = SparkContext.updatedConf(new SparkConf(false), master, appName)
myConf.set("spark.cleaner.ttl", "10s")
ssc = new StreamingContext(myConf, batchDuration)
assert(Utils.timeStringToS(ssc.conf.get("spark.cleaner.ttl", "-1s")) === 10)
assert(Utils.timeStringAsS(ssc.conf.get("spark.cleaner.ttl", "-1s")) === 10)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comment about -1s

}

test("from existing SparkContext") {
Expand All @@ -87,7 +87,7 @@ class StreamingContextSuite extends FunSuite with BeforeAndAfter with Timeouts w
val myConf = SparkContext.updatedConf(new SparkConf(false), master, appName)
myConf.set("spark.cleaner.ttl", "10s")
ssc = new StreamingContext(myConf, batchDuration)
assert(Utils.timeStringToS(ssc.conf.get("spark.cleaner.ttl", "-1s")) === 10)
assert(Utils.timeStringAsS(ssc.conf.get("spark.cleaner.ttl", "-1s")) === 10)
}

test("from checkpoint") {
Expand All @@ -98,12 +98,12 @@ class StreamingContextSuite extends FunSuite with BeforeAndAfter with Timeouts w
ssc1.start()
val cp = new Checkpoint(ssc1, Time(1000))
assert(
Utils.timeStringToS(cp.sparkConfPairs.toMap.getOrElse("spark.cleaner.ttl", "-1s")) === 10)
Utils.timeStringAsS(cp.sparkConfPairs.toMap.getOrElse("spark.cleaner.ttl", "-1s")) === 10)
ssc1.stop()
val newCp = Utils.deserialize[Checkpoint](Utils.serialize(cp))
assert(Utils.timeStringToS(newCp.createSparkConf().get("spark.cleaner.ttl", "-1s")) === 10)
assert(Utils.timeStringAsS(newCp.createSparkConf().get("spark.cleaner.ttl", "-1s")) === 10)
ssc = new StreamingContext(null, newCp, null)
assert(Utils.timeStringToS(ssc.conf.get("spark.cleaner.ttl", "-1s")) === 10)
assert(Utils.timeStringAsS(ssc.conf.get("spark.cleaner.ttl", "-1s")) === 10)
}

test("start and stop state check") {
Expand Down