Created
July 31, 2015 09:53
Smart Thermostat AWS Spark - Part Spark retrieve scenario information
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//spark settings | |
val sparkconf = new SparkConf().setAppName("tempscore") | |
val sc = new SparkContext(sparkconf) | |
//get scenario information from husedscenario table | |
val confmrscen = HBaseConfiguration.create() | |
val rowval = args(0).getBytes() //used scenario key is input | |
val getscenvals = new Get(rowval) | |
val tablescenvals = new HTable(confmrscen,"husedscenario") | |
val resgetscenvals = tablescenvals.get(getscenvals) | |
val valscenariokey = resgetscenvals.getValue("fd".getBytes(), "scenariokey".getBytes()) | |
val valsettemp : Int = Bytes.toString(resgetscenvals.getValue("fd".getBytes(), "settemp".getBytes())).toInt | |
val valrevepoch : Long = Bytes.toString(rowval).substring(9,19).toLong | |
val valmaxrevepoch : Long = valrevepoch - (60L*60L) //limit to one hour after scenario started | |
tablescenvals.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment