aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/scala/parallelai/spyglass/hbase/example/HBaseExampleRunner.scala
blob: 890d2bed9863672784efa3f701122e67922292ef (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
package parallelai.spyglass.hbase.example

import com.twitter.scalding.Tool
import org.joda.time.format.DateTimeFormat
import java.util.Formatter.DateTime

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 _ => "--local"
  }}
  
  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.tsv"

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