public ServiceSpecificationCodec() { twillSpecificationAdapter = TwillRuntimeSpecificationAdapter.create(); }
public ServiceSpecificationCodec() { twillSpecificationAdapter = TwillRuntimeSpecificationAdapter.create(); }
/** * 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(); }
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(); }
null, logLevels, maxRetries, configMap, runnableConfigs); TwillRuntimeSpecificationAdapter.create().toJson(twillRuntimeSpec, writer); LOG.debug("Done {}", targetFile); return twillRuntimeSpec;
null, logLevels, maxRetries, configMap, runnableConfigs); TwillRuntimeSpecificationAdapter.create().toJson(twillRuntimeSpec, writer); LOG.debug("Done {}", targetFile); return twillRuntimeSpec;
TwillRuntimeSpecificationAdapter.create().toJson(twillRuntimeSpec));
config.get(YarnConfiguration.RM_SCHEDULER_ADDRESS), logLevels, maxRetries, configMap, runnableConfigs); TwillRuntimeSpecificationAdapter.create().toJson(twillRuntimeSpec, writer); LOG.debug("Done {}", targetFile); return twillRuntimeSpec;
TwillRuntimeSpecificationAdapter.create().toJson(twillRuntimeSpec));
config.get(YarnConfiguration.RM_SCHEDULER_ADDRESS), logLevels, maxRetries, configMap, runnableConfigs); TwillRuntimeSpecificationAdapter.create().toJson(twillRuntimeSpec, writer); LOG.debug("Done {}", targetFile); return twillRuntimeSpec;
@Override protected void doStart() throws Exception { LOG.info("Start application master with spec: {}", TwillRuntimeSpecificationAdapter.create().toJson(twillRuntimeSpec)); // initialize the event handler, if it fails, it will fail the application. eventHandler.initialize(new BasicEventHandlerContext(twillRuntimeSpec)); // call event handler started. eventHandler.started(); instanceChangeExecutor = Executors.newSingleThreadExecutor(Threads.createDaemonThreadFactory("instanceChanger")); // Creates ZK path for runnable. It's ok if the path already exists. // That's for the case when the AM get killed and restarted ZKOperations.ignoreError( zkClient.create("/" + runId.getId() + "/runnables", null, CreateMode.PERSISTENT), KeeperException.NodeExistsException.class, null) .get(); runningContainers.addWatcher(Constants.DISCOVERY_PATH_PREFIX); runnableContainerRequests = initContainerRequests(); }
@Override protected void doStart() throws Exception { LOG.info("Start application master with spec: {}", TwillRuntimeSpecificationAdapter.create().toJson(twillRuntimeSpec)); // initialize the event handler, if it fails, it will fail the application. eventHandler.initialize(new BasicEventHandlerContext(twillRuntimeSpec)); // call event handler started. eventHandler.started(); instanceChangeExecutor = Executors.newSingleThreadExecutor(Threads.createDaemonThreadFactory("instanceChanger")); // Creates ZK path for runnable. It's ok if the path already exists. // That's for the case when the AM get killed and restarted ZKOperations.ignoreError( zkClient.create("/" + runId.getId() + "/runnables", null, CreateMode.PERSISTENT), KeeperException.NodeExistsException.class, null) .get(); runningContainers.addWatcher(Constants.DISCOVERY_PATH_PREFIX); runnableContainerRequests = initContainerRequests(); }