Java Code Examples for mesosphere.marathon.client.model.v2.App#setArgs()

The following examples show how to use mesosphere.marathon.client.model.v2.App#setArgs() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PravegaSegmentStoreService.java    From pravega with Apache License 2.0 4 votes vote down vote up
private App createPravegaSegmentStoreApp() {
    App app = new App();
    app.setId(this.id);
    app.setCpus(cpu);
    app.setMem(mem);
    app.setInstances(instances);
    //set constraints
    app.setConstraints(setConstraint("hostname", "UNIQUE"));
    //docker container
    app.setContainer(new Container());
    app.getContainer().setType(CONTAINER_TYPE);
    app.getContainer().setDocker(new Docker());
    //set the image and network
    app.getContainer().getDocker().setImage(IMAGE_PATH + "/nautilus/pravega:" + PRAVEGA_VERSION);
    //set port
    app.setPortDefinitions(Arrays.asList(createPortDefinition(SEGMENTSTORE_PORT)));
    app.setRequirePorts(true);
    //healthchecks
    List<HealthCheck> healthCheckList = new ArrayList<HealthCheck>();
    healthCheckList.add(setHealthCheck(300, "TCP", false, 60, 20, 0, SEGMENTSTORE_PORT));
    app.setHealthChecks(healthCheckList);
    //set env
    String zk = zkUri.getHost() + ":" + ZKSERVICE_ZKPORT;

    //Environment variables to configure SS service.
    Map<String, Object> map = new HashMap<>();
    map.put("ZK_URL", zk);
    map.put("BK_ZK_URL", zk);
    map.put("CONTROLLER_URL", conUri.toString());
    getCustomEnvVars(map, SEGMENTSTORE_EXTRA_ENV);

    //Properties set to override defaults for system tests
    String hostSystemProperties = "-Xmx1024m" +
            setSystemProperty("autoScale.muteInSeconds", "120") +
            setSystemProperty("autoScale.cooldownInSeconds", "120") +
            setSystemProperty("autoScale.cacheExpiryInSeconds", "120") +
            setSystemProperty("autoScale.cacheCleanUpInSeconds", "120") +
            setSystemProperty("log.level", "DEBUG") +
            setSystemProperty("log.dir", "$MESOS_SANDBOX/pravegaLogs") +
            setSystemProperty("curator-default-session-timeout", String.valueOf(30 * 1000)) +
            setSystemProperty("hdfs.replaceDataNodesOnFailure", "false");

    map.put("PRAVEGA_SEGMENTSTORE_OPTS", hostSystemProperties);
    app.setEnv(map);
    app.setArgs(Arrays.asList("segmentstore"));

    return app;
}
 
Example 2
Source File: PravegaControllerService.java    From pravega with Apache License 2.0 4 votes vote down vote up
/**
 * To configure the controller app.
 *
 * @return App instance of marathon app
 */
private App createPravegaControllerApp() {
    App app = new App();
    app.setId(this.id);
    app.setCpus(cpu);
    app.setMem(mem);
    app.setInstances(instances);
    app.setConstraints(setConstraint("hostname", "UNIQUE"));
    app.setContainer(new Container());
    app.getContainer().setType(CONTAINER_TYPE);
    app.getContainer().setDocker(new Docker());
    app.getContainer().getDocker().setImage(IMAGE_PATH + "/nautilus/pravega:" + PRAVEGA_VERSION);
    String zk = zkUri.getHost() + ":" + ZKSERVICE_ZKPORT;
    //set port
    app.setPortDefinitions(Arrays.asList(createPortDefinition(CONTROLLER_PORT), createPortDefinition(REST_PORT)));
    app.setRequirePorts(true);
    List<HealthCheck> healthCheckList = new ArrayList<HealthCheck>();
    healthCheckList.add(setHealthCheck(300, "TCP", false, 60, 20, 0, CONTROLLER_PORT));
    app.setHealthChecks(healthCheckList);

    String componentCode = "controller";

    //set env
    String controllerSystemProperties = "-Xmx512m" +
            setSystemProperty(Config.PROPERTY_ZK_URL.getFullName(componentCode), zk) +
            setSystemProperty(Config.PROPERTY_RPC_HOST.getFullName(componentCode), this.id + ".marathon.mesos") +
            setSystemProperty(Config.PROPERTY_RPC_PORT.getFullName(componentCode), String.valueOf(CONTROLLER_PORT)) +
            setSystemProperty(Config.PROPERTY_SERVICE_PORT.getFullName(componentCode), String.valueOf(CONTROLLER_PORT)) +
            setSystemProperty(Config.PROPERTY_REST_PORT.getFullName(componentCode), String.valueOf(REST_PORT)) +
            setSystemProperty("log.level", "DEBUG") +
            setSystemProperty("log.dir", "$MESOS_SANDBOX/pravegaLogs") +
            setSystemProperty("curator-default-session-timeout", String.valueOf(10 * 1000)) +
            setSystemProperty(Config.PROPERTY_TXN_MAX_LEASE.getFullName(componentCode), String.valueOf(120 * 1000)) +
            setSystemProperty(Config.PROPERTY_RETENTION_FREQUENCY_MINUTES.getFullName(componentCode), String.valueOf(2));

    Map<String, Object> map = new HashMap<>();
    map.put("PRAVEGA_CONTROLLER_OPTS", controllerSystemProperties);
    app.setEnv(map);
    app.setArgs(Arrays.asList("controller"));

    return app;
}