aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/scala/parallelai/spyglass/hbase/example/HBaseExampleRunner.scala
blob: 920f17de531694d61cfd1ad12a1ede4e303cd671 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package parallelai.spyglass.hbase.example

import com.twitter.scalding.Tool
import org.joda.time.format.DateTimeFormat
import java.util.Formatter.DateTime
import parallelai.spyglass.base.JobRunner

object HBaseExampleRunner extends App {
   val appPath = System.getenv("BIGDATA_APPCONF_PATH")
   assert(appPath != null, { "Environment Variable BIGDATA_APPCONF_PATH is undefined or Null" })
   println("Application Path is [%s]".format(appPath))

   val modeString = if (args.length == 0) { "--hdfs" } else {
      args(0) match {
         case "hdfs" => "--hdfs"
         case _ => "--hdfs"
      }
   }

   println(modeString)

   val jobLibPath = modeString match {
      case "--hdfs" => {
         val jobLibPath = System.getenv("BIGDATA_JOB_LIB_PATH")
         assert(jobLibPath != null, { "Environment Variable BIGDATA_JOB_LIB_PATH is undefined or Null" })
         println("Job Library Path Path is [%s]".format(jobLibPath))
         jobLibPath
      }
      case _ => ""
   }

   val quorum = System.getenv("BIGDATA_QUORUM_NAMES")
   assert(quorum != null, { "Environment Variable BIGDATA_QUORUM_NAMES is undefined or Null" })
   println("Quorum is [%s]".format(quorum))

   val output = "HBaseTest.%s"

   JobRunner.main(Array(classOf[HBaseExample].getName, "--hdfs", "--app.conf.path", appPath,
      "--output", output, "--debug", "true", "--job.lib.path", jobLibPath, "--quorum", quorum))

}