Load Charmader Utilities


In [1]:
import org.att.charmander.CharmanderUtils

 

See what tasks are currently running and pick first test


In [8]:
val runningSimulators = CharmanderUtils.getMeteredTaskNamesFromRedis
val simulatorToInvestigate = runningSimulators(0)
runningSimulators


Out[8]:
List(lookbusy80)

 

Retrieve memory-usage datapoints for the first simulator


In [3]:
val memoryUsage= CharmanderUtils.getRDDForTask(sc, simulatorToInvestigate, "memory_usage", 100)

 

Just for curiosity lets look at the first data point


In [4]:
memoryUsage.first


Out[4]:
List(1425192395000, 4050001, 84971520)

 

Translate Datapoints in to a Spark-SQL Database


In [5]:
val sqlContext = new org.apache.spark.sql.SQLContext(sc)
import sqlContext._

case class MemoryUsage(timestamp: BigDecimal, memory: BigDecimal)

val memoryusageRdd = memoryUsage.map(p => MemoryUsage(BigDecimal(p(0).asInstanceOf[BigInt]), BigDecimal(p(2).asInstanceOf[BigInt])))
memoryusageRdd.registerTempTable("memoryusage")

 

Get max-memory usage


In [9]:
val newestMax = sqlContext.sql("select max(memory) from memoryusage").first()
newestMax


Out[9]:
[84971520]

 

Set the new max value in our task intelligence database


In [7]:
CharmanderUtils.setTaskIntelligence(simulatorToInvestigate, "mem", newestMax(0).toString)

To Verify that the value is set

Visit redis and look for the task-intelligence section


In [20]: