.setEnvironment(Protos.Environment.newBuilder() .addVariables(Protos.Environment.Variable.newBuilder() .setName("IGNITE_TCP_DISCOVERY_ADDRESSES") .setName("JVM_OPTS") .setValue(clusterProps.jmvOpts()))) .addUris(Protos.CommandInfo.URI.newBuilder() .setValue(clusterProps.ignitePackageUrl() != null ? clusterProps.ignitePackageUrl() : resourceProvider.igniteUrl()) .setExtract(true)) .addUris(Protos.CommandInfo.URI.newBuilder() .setValue(cfgUrl)); builder.addUris(Protos.CommandInfo.URI.newBuilder().setValue(url)); licenceFile = fileName(clusterProps.licenceUrl()); builder.setValue( (licenceFile != null ? "find . -maxdepth 1 -name \"" + licenceFile + "\" -exec cp {} ./*/ \\; && " : "") + "find . -maxdepth 1 -name \"*.jar\" -exec cp {} ./*/libs/ \\; && "
final Protos.Environment.Builder env = cmd.getEnvironmentBuilder(); final StringBuilder jvmArgs = new StringBuilder(); cmd.addUris(Utils.uri(resolver, artifact)); cmd.addUris(CommandInfo.URI.newBuilder().setValue(uri)); .append(" ") .append(ContainerSpecification.formatSystemProperties(dynamicProperties)); cmd.setValue(launchCommand.toString());
.setEnvironment(envBuilder) .setValue(String.format("cd %s && %s", directory, command)); if (uri != null) { commandInfo.addUris(CommandInfo.URI.newBuilder().setValue(uri)); commandInfo.setContainer(org.apache.mesos.hadoop.Utils.buildContainerInfo(scheduler.conf)); .setRole(diskRole) .setScalar(Value.Scalar.newBuilder().setValue(containerDisk))) .setCommand(commandInfo.build());
.setEnvironment(envBuilder) .setValue(String.format("cd %s && %s", directory, command)) .addUris(CommandInfo.URI.newBuilder().setValue(uri)).build();
taskBuilder.getCommandBuilder().setEnvironment( EnvUtils.withEnvVar( taskBuilder.getCommandBuilder().getEnvironment(), portEnvKey, portEnvVal)); Protos.CommandInfo.Builder healthCheckCmdBuilder = taskBuilder.getHealthCheckBuilder().getCommandBuilder(); healthCheckCmdBuilder.setEnvironment( EnvUtils.withEnvVar(healthCheckCmdBuilder.getEnvironment(), portEnvKey, portEnvVal)); } else { logger.info("Health check is not defined for task: {}", taskName); checkCmdBuilder.setEnvironment( EnvUtils.withEnvVar(checkCmdBuilder.getEnvironment(), portEnvKey, portEnvVal)); if (portEnvKey != null) { Protos.CommandInfo.Builder executorCmdBuilder = executorBuilder.getCommandBuilder(); executorCmdBuilder.setEnvironment( EnvUtils.withEnvVar(executorCmdBuilder.getEnvironment(), portEnvKey, portEnvVal));
commandBuilder.setEnvironment(EnvUtils.toProto(getTaskEnvironment(serviceName, podInstance, taskSpec, commandBuilder.setValue(schedulerConfig.getPauseOverrideCmd()); } else { commandBuilder.setValue(taskSpec.getCommand().get().getValue()); commandBuilder.addUrisBuilder().setValue(schedulerConfig.getBootstrapURI()); commandBuilder.addUrisBuilder().setValue(uri.toString()); commandBuilder.addUrisBuilder() .setValue(templateUrlFactory.get( targetConfigurationId, podSpec.getType(), taskSpec.getName(), config.getName())) commandBuilder.getEnvironmentBuilder().addVariablesBuilder() .setName(secretSpec.getEnvKey().get()) .setType(Protos.Environment.Variable.Type.SECRET) commandBuilder.setUser(podSpec.getUser().get());
.setCommand(CommandInfo.newBuilder() .setValue(executorLaunchCommand) .addUris(URI.newBuilder().setValue(reefTarUri).build()) .build()) .build();
.getEnvironmentBuilder() .addVariablesBuilder() .setName(TestConstants.PORT_ENV_NAME)
.setTaskId(taskId) .setSlaveId(offer.getSlaveId()) .setCommand(commandBuilder.build());
.setScalar(Protos.Value.Scalar.newBuilder().setValue(128))) .setContainer(containerInfoBuilder) .setCommand(Protos.CommandInfo.newBuilder().setShell(false)) .build();
CommandInfo .newBuilder() .setValue(cmd)).build();
.addUris(URI.newBuilder().setValue(configUri)) .setValue(commandLineShim.getCommandLine(details.getId()))) .setContainer(ContainerInfo.newBuilder() .setType(ContainerInfo.Type.DOCKER) } else { executorInfoBuilder.setCommand(CommandInfo.newBuilder() .addUris(URI.newBuilder().setValue((String) mesosStormConf.get(CONF_EXECUTOR_URI))) .addUris(URI.newBuilder().setValue(configUri)) .setValue(commandLineShim.getCommandLine(details.getId())));
.setValue(healthCheckSpec.getCommand()) .setEnvironment(EnvUtils.toProto(getTaskEnvironment(serviceName, podInstance, taskSpec,
private void setReadinessCheck( Protos.TaskInfo.Builder taskInfoBuilder, String serviceName, PodInstance podInstance, TaskSpec taskSpec, GoalStateOverride override, SchedulerConfig schedulerConfig) { Optional<ReadinessCheckSpec> readinessCheckSpecOptional = getReadinessCheck(taskSpec, override); if (!readinessCheckSpecOptional.isPresent()) { LOGGER.debug("No readiness check defined for taskSpec: {}", taskSpec.getName()); return; } ReadinessCheckSpec readinessCheckSpec = readinessCheckSpecOptional.get(); // Default executor supports the newer TaskInfo.check field: Protos.CheckInfo.Builder builder = taskInfoBuilder.getCheckBuilder() .setType(Protos.CheckInfo.Type.COMMAND) .setDelaySeconds(readinessCheckSpec.getDelay()) .setIntervalSeconds(readinessCheckSpec.getInterval()) .setTimeoutSeconds(readinessCheckSpec.getTimeout()); builder.getCommandBuilder().getCommandBuilder() .setValue(readinessCheckSpec.getCommand()) .setEnvironment(EnvUtils.toProto(getTaskEnvironment(serviceName, podInstance, taskSpec, schedulerConfig))); }
commandBuilder.setShell(false); commandBuilder.setValue(customShell); List args = new ArrayList(); args.add(jenkinsCommand2Run); commandBuilder.addAllArguments( args ); commandBuilder.setValue(jenkinsCommand2Run); commandBuilder.addUris( CommandInfo.URI.newBuilder().setValue( joinPaths(jenkinsMaster, SLAVE_JAR_URI_SUFFIX)).setExecutable(false).setExtract(false));
@Override public Protos.CommandInfo create(Map<String, String> additionalEnvironmentVariables) { Protos.CommandInfo.Builder builder = Protos.CommandInfo.newBuilder(); Optional<String> command = Optional.ofNullable(mesosConfig.getCommand()); builder.setShell(command.isPresent()); command.ifPresent(builder::setValue); builder.addAllUris(mesosConfig.getUri().stream().map(uri -> Protos.CommandInfo.URI.newBuilder().setValue(uri).build()).collect(Collectors.toList())); Map<String, String> environmentVariables = new LinkedHashMap<>(); environmentVariables.putAll(additionalEnvironmentVariables); environmentVariables.putAll(mesosConfig.getEnvironment()); //todo: migrate to foreach environmentVariables.entrySet().stream() .map(kv -> Protos.Environment.Variable.newBuilder().setName(kv.getKey()).setValue(kv.getValue()).build()) .collect(Collectors.collectingAndThen( Collectors.toList(), variables -> builder.setEnvironment(Protos.Environment.newBuilder().addAllVariables(variables)))); return builder.build(); } }
public static Protos.TaskInfo getDefaultTaskInfo() { return Protos.TaskInfo.newBuilder() .setName("dummyTaskName") .setTaskId(Protos.TaskID.newBuilder().setValue(SLAVE_ID)) .setSlaveId(getSlaveId()) .setExecutor(Protos.ExecutorInfo.newBuilder() .setExecutorId(getExecutorId()) .setCommand(Protos.CommandInfo.newBuilder().setValue("").build()) .build()) .setDiscovery( Protos.DiscoveryInfo.newBuilder() .setVisibility(Protos.DiscoveryInfo.Visibility.EXTERNAL) .setPorts(Protos.Ports.newBuilder() .addPorts(Discovery.CLIENT_PORT_INDEX, Protos.Port.newBuilder().setNumber(9200)) .addPorts(Discovery.TRANSPORT_PORT_INDEX, Protos.Port.newBuilder().setNumber(9300)) ) ) .build(); }
private static void updateFaultDomainEnv(Protos.TaskInfo.Builder builder, Protos.Offer offer) { if (!offer.hasDomain() || !offer.getDomain().hasFaultDomain() || !builder.hasCommand()) { return; } Protos.Environment.Variable regionVar = Protos.Environment.Variable.newBuilder() .setName(EnvConstants.REGION_TASKENV) .setValue(offer.getDomain().getFaultDomain().getRegion().getName()) .build(); Protos.Environment.Variable zoneVar = Protos.Environment.Variable.newBuilder() .setName(EnvConstants.ZONE_TASKENV) .setValue(offer.getDomain().getFaultDomain().getZone().getName()) .build(); builder.getCommandBuilder() .getEnvironmentBuilder() .addVariables(regionVar) .addVariables(zoneVar); } }