Smart Thermostat AWS Spark - Part Spark retrieve scenario information
//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