aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/scala/parallelai/spyglass/hbase/example/HBaseExampleRunner.scala
blob: d6b762e5f2f81fb0a16a94f5f2ca0f28d15fcd22 (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
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 output = "HBaseTest.%s.tsv"

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