return 0;
}
private List<Job> configureJobs(String jobSetupScript, String[] arguments) throws Exception {
ScriptingContainer runtime = InstanceContainer.getRuntime();
Configuration conf = getConf();
conf.set(InstanceContainer.JOB_SETUP_SCRIPT_KEY, jobSetupScript);
Object contextClass = runtime.runScriptlet("Rubydoop::Context");
Object context = runtime.callMethod(contextClass, "new", conf, arguments);
runtime.put("$rubydoop_context", context);
try {
runtime.callMethod(null, "require", jobSetupScript);
} catch (InvokeFailedException e) {
String message = String.format("Could not load job setup script (\"%s\"): \"%s\"", jobSetupScript, e.getMessage());
throw new RubydoopRunnerException(message, e);
}
List<Job> jobs = (List<Job>) runtime.callMethod(context, "jobs");
for (Job job : jobs) {
job.setJarByClass(getClass());
}