Skip to content
Browse files

Make Main runner class and runner script more verbose to help diagnos…

…e runner errors
  • Loading branch information...
1 parent e284762 commit 1274f241436b87399a7035f7078f335b005a0e3a @mrwalker committed Apr 4, 2011
Showing with 34 additions and 30 deletions.
  1. +31 −30 src/cascading/jruby/Main.java
  2. +3 −0 src/cascading/jruby/runner.rb
View
61 src/cascading/jruby/Main.java
@@ -4,34 +4,35 @@
import org.jruby.RubyInstanceConfig;
public class Main {
- private final static String JRUBY_HOME = "/opt/jruby";
-
- /**
- * Starts an Hadoop job by reading the specified JRuby script. The syntax is
- * : <verbatim> hadoop jar myjob.jar cascading.jruby.JobRunner myjob.rb
- * <input> <output> </verbatim>
- *
- * @param args
- */
- public static void main(String[] args) {
- String name = args[0]; // the main script name.
- if (!name.startsWith("/"))
- name = "/" + name;
-
- // Ruby script arguments:
- String[] newArgs = new String[args.length - 1];
- System.arraycopy(args, 1, newArgs, 0, args.length - 1);
- RubyInstanceConfig config = new RubyInstanceConfig();
- config.setJRubyHome(JRUBY_HOME); // mwalker
- config.processArguments(newArgs);
-
- System.out.println("Arguments: ");
- for (String arg : config.getArgv())
- System.out.println(arg);
-
- Ruby runtime = Ruby.newInstance(config);
-
- runtime.executeScript("require '" + name + "'", name);
- runtime.executeScript("require 'cascading/jruby/runner'", null); // gfodor
- }
+ private final static String JRUBY_HOME = "/opt/jruby";
+
+ /**
+ * Starts a Hadoop job by reading the specified JRuby script.
+ *
+ * @param args
+ */
+ public static void main(String[] args) {
+ String name = args[0]; // c.j script name
+ if (!name.startsWith("/"))
+ name = "/" + name;
+
+ // c.j script args
+ String[] newArgs = new String[args.length - 1];
+ System.arraycopy(args, 1, newArgs, 0, args.length - 1);
+ RubyInstanceConfig config = new RubyInstanceConfig();
+ config.setJRubyHome(JRUBY_HOME); // mwalker
+ config.processArguments(newArgs);
+
+ System.out.println("Arguments: ");
+ for (String arg : config.getArgv())
+ System.out.println(arg);
+
+ Ruby runtime = Ruby.newInstance(config);
+
+ System.out.println("Requiring '" + name + "'");
+ runtime.executeScript("require '" + name + "'", name);
+
+ System.out.println("Requiring 'cascading/jruby/runner'");
+ runtime.executeScript("require 'cascading/jruby/runner'", "runner"); // gfodor
+ }
}
View
3 src/cascading/jruby/runner.rb
@@ -1,3 +1,6 @@
+puts "Found #{Cascading::Cascade.all.size} Cascades in global registry"
+
Cascading::Cascade.all.each do |cascade|
+ puts "runner.rb running '#{cascade.name}' Cascade"
cascade.complete
end

0 comments on commit 1274f24

Please sign in to comment.
Something went wrong with that request. Please try again.