in wayang-benchmark/code/main/scala/org/apache/wayang/apps/sindy/Sindy.scala [106:143]
def main(args: Array[String]): Unit = {
// Parse parameters.
if (args.isEmpty) {
sys.error(s"Usage: <main class> ${Parameters.experimentHelp} <plugin>(,<plugin>)* <CSV separator> <input URL>(;<input URL>)*")
sys.exit(1)
}
implicit val configuration = new Configuration
implicit val experiment = Parameters.createExperiment(args(0), this)
val plugins = Parameters.loadPlugins(args(1))
experiment.getSubject.addConfiguration("plugins", args(1))
val separator = if (args(2).length == 1) args(2).charAt(0) else args(2) match {
case "tab" => '\t'
case "\\t" => '\t'
case "comma" => ','
case "semicolon" => ';'
case "\\|" => '|'
case "pipe" => '|'
case other: String => throw new IllegalArgumentException("Unknown separator.")
}
val inputUrls = args(3).split(";")
experiment.getSubject.addConfiguration("inputs", inputUrls)
// Prepare the PageRank.
val sindy = new Sindy(plugins: _*)
// Run the PageRank.
val inds = sindy(inputUrls.toSeq, separator).toSeq
// Store experiment data.
val inputFileSizes = inputUrls.map(url => FileSystems.getFileSize(url))
if (inputFileSizes.forall(_.isPresent))
experiment.getSubject.addConfiguration("inputSize", inputFileSizes.map(_.getAsLong).sum)
ProfileDBHelper.store(experiment, configuration)
// Print the result.
StdOut.printLimited(inds)
}