Hey Terence,
This is vanilla apache 2.0.5-alpha that I am playing with. I started with mostly pasting your example code from the tutorial over into a class to try out. I just found your actual test and I can get it to run fine against my Yarn instance. I think there is something subtle about initialization that I do not understand. With this controller setup:
WeaveController controller = runnerService
.prepare(
new App(),
ResourceSpecification.Builder.with().setCores(1)
.setMemory(1, ResourceSpecification.SizeUnit.GIGA).setInstances(2).build())
.addLogHandler(new PrinterLogHandler(new PrintWriter(System.out, true)))
.withApplicationArguments("echo").withArguments("App", "echo2").start();
This initialize will NOT work, causes my error:
@Override
public void initialize(WeaveContext context) {
super.initialize(context);
running = true;
LOG.info("initialize method called");
try {
serverSocket = new ServerSocket(0);
LOG.info("App came up on port " + serverSocket.getLocalPort());
context.announce("echo", serverSocket.getLocalPort());
} catch (IOException e) {
LOG.error("well damn, init filed", e);
}
}
Yet this one works fine (copied from your EchoServer):
@Override
public void initialize(WeaveContext context) {
super.initialize(context);
running = true;
try {
serverSocket = new ServerSocket(0);
LOG.info("EchoServer started: " + serverSocket.getLocalSocketAddress() + ", id: " + context.getInstanceId()
+ ", count: " + context.getInstanceCount());
context.announce(context.getApplicationArguments()[0], serverSocket.getLocalPort());
context.announce(context.getArguments()[0], serverSocket.getLocalPort());
} catch (IOException e) {
throw Throwables.propagate(e);
}
}
Is there something significant about grabbing the context that I dont know?
Also is there a way to lower the default debug level, I get so much dfs output at the moment its kinda hard to debug.
Thanks for the reply!
~Garrett