public TwillRuntimeSpecification fromJson(File file) throws IOException { try (Reader reader = Files.newReader(file, Charsets.UTF_8)) { return fromJson(reader); } }
public TwillRuntimeSpecification fromJson(File file) throws IOException { try (Reader reader = Files.newReader(file, Charsets.UTF_8)) { return fromJson(reader); } }
/** * Starts the application master. */ public static void main(String[] args) throws Exception { File twillSpec = new File(Constants.Files.RUNTIME_CONFIG_JAR, Constants.Files.TWILL_SPEC); TwillRuntimeSpecification twillRuntimeSpec = TwillRuntimeSpecificationAdapter.create().fromJson(twillSpec); new ApplicationMasterMain(twillRuntimeSpec).doMain(); }
/** * Main method for launching a {@link TwillContainerService} which runs * a {@link org.apache.twill.api.TwillRunnable}. */ public static void main(String[] args) throws Exception { File twillSpecFile = new File(Constants.Files.RUNTIME_CONFIG_JAR, Constants.Files.TWILL_SPEC); TwillRuntimeSpecification twillRuntimeSpec = TwillRuntimeSpecificationAdapter.create().fromJson(twillSpecFile); new TwillContainerMain(twillRuntimeSpec).doMain(); }
/** * Starts the application master. */ public static void main(String[] args) throws Exception { File twillSpec = new File(Constants.Files.RUNTIME_CONFIG_JAR, Constants.Files.TWILL_SPEC); TwillRuntimeSpecification twillRuntimeSpec = TwillRuntimeSpecificationAdapter.create().fromJson(twillSpec); new ApplicationMasterMain(twillRuntimeSpec).doMain(); }
/** * Main method for launching a {@link TwillContainerService} which runs * a {@link org.apache.twill.api.TwillRunnable}. */ public static void main(String[] args) throws Exception { File twillSpecFile = new File(Constants.Files.RUNTIME_CONFIG_JAR, Constants.Files.TWILL_SPEC); TwillRuntimeSpecification twillRuntimeSpec = TwillRuntimeSpecificationAdapter.create().fromJson(twillSpecFile); new TwillContainerMain(twillRuntimeSpec).doMain(); }
protected void doMain() throws Exception { TwillRuntimeSpecification twillRuntimeSpec = TwillRuntimeSpecificationAdapter.create() .fromJson(new File(Constants.Files.RUNTIME_CONFIG_JAR, Constants.Files.TWILL_SPEC)); org.apache.twill.internal.Arguments arguments = readJsonFile(new File(Constants.Files.RUNTIME_CONFIG_JAR, Constants.Files.ARGUMENTS), org.apache.twill.internal.Arguments.class); TwillContext context = new DirectExecutionTwillContext(name, twillRuntimeSpec, arguments); initialize(context); Runtime.getRuntime().addShutdownHook(new Thread(AbstractProgramTwillRunnable.this::stop)); // Add the program state writer listener when the program controller is available ProgramStateWriter programStateWriter = injector.getInstance(ProgramStateWriter.class); controllerFuture.thenAcceptAsync( c -> c.addListener(new StateChangeListener(c.getProgramRunId(), null, programStateWriter), Threads.SAME_THREAD_EXECUTOR), command -> { Thread t = new Thread(command); t.start(); }); run(); }
private ServiceSpecification decodeOldSpec(JsonObject json) { String className = json.get("classname").getAsString(); TwillSpecification twillSpec = twillSpecificationAdapter.fromJson(json.get("spec").getAsString()).getTwillSpecification(); Map<String, HttpServiceHandlerSpecification> handlers = Maps.newHashMap();
protected void doMain() throws Exception { TwillRuntimeSpecification twillRuntimeSpec = TwillRuntimeSpecificationAdapter.create() .fromJson(new File(Constants.Files.RUNTIME_CONFIG_JAR, Constants.Files.TWILL_SPEC)); org.apache.twill.internal.Arguments arguments = readJsonFile(new File(Constants.Files.RUNTIME_CONFIG_JAR, Constants.Files.ARGUMENTS), org.apache.twill.internal.Arguments.class); TwillContext context = new DirectExecutionTwillContext(name, twillRuntimeSpec, arguments); initialize(context); Runtime.getRuntime().addShutdownHook(new Thread(AbstractProgramTwillRunnable.this::stop)); // Add the program state writer listener when the program controller is available ProgramStateWriter programStateWriter = injector.getInstance(ProgramStateWriter.class); controllerFuture.thenAcceptAsync( c -> c.addListener(new StateChangeListener(c.getProgramRunId(), null, programStateWriter), Threads.SAME_THREAD_EXECUTOR), command -> { Thread t = new Thread(command); t.start(); }); run(); }
private ServiceSpecification decodeOldSpec(JsonObject json) { String className = json.get("classname").getAsString(); TwillSpecification twillSpec = twillSpecificationAdapter.fromJson(json.get("spec").getAsString()).getTwillSpecification(); Map<String, HttpServiceHandlerSpecification> handlers = Maps.newHashMap();