/** * Construct a Mesos URI. */ public static Protos.CommandInfo.URI uri(MesosArtifactResolver resolver, ContainerSpecification.Artifact artifact) { checkNotNull(resolver); checkNotNull(artifact); Option<URL> url = resolver.resolve(artifact.dest); if (url.isEmpty()) { throw new IllegalArgumentException("Unresolvable artifact: " + artifact.dest); } return Protos.CommandInfo.URI.newBuilder() .setValue(url.get().toExternalForm()) .setOutputFile(artifact.dest.toString()) .setExtract(artifact.extract) .setCache(artifact.cachable) .setExecutable(artifact.executable) .build(); }
/** * Construct a Mesos URI. */ public static Protos.CommandInfo.URI uri(URL url, boolean cacheable) { checkNotNull(url); return Protos.CommandInfo.URI.newBuilder() .setValue(url.toExternalForm()) .setExtract(false) .setCache(cacheable) .build(); }
cmd.addUris(CommandInfo.URI.newBuilder().setValue(uri));
.setValue(String.format("cd %s && %s", directory, command)); if (uri != null) { commandInfo.addUris(CommandInfo.URI.newBuilder().setValue(uri));
.setEnvironment(envBuilder) .setValue(String.format("cd %s && %s", directory, command)) .addUris(CommandInfo.URI.newBuilder().setValue(uri)).build();
.addUris(URI.newBuilder().setValue((String) mesosStormConf.get(CONF_EXECUTOR_URI))) .addUris(URI.newBuilder().setValue(configUri)) .setValue(logviewerCommand);
.addUris(URI.newBuilder().setValue(configUri)) .setValue(commandLineShim.getCommandLine(details.getId()))) .setContainer(ContainerInfo.newBuilder() } 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())));
CommandInfo.URI.newBuilder().setValue( joinPaths(jenkinsMaster, SLAVE_JAR_URI_SUFFIX)).setExecutable(false).setExtract(false)); return commandBuilder;
@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 Collection<CommandInfo.URI> createURIs( final Set<String> uris, boolean cacheFetchedUris) { return uris.stream() .map(uri -> CommandInfo.URI.newBuilder() .setCache(cacheFetchedUris) .setExecutable(false) .setExtract(true) .setValue(uri).build()) .collect(Collectors.toList()); }
private void detectAndAddAdditionalURIs(Request request, CommandInfo.Builder commandBuilder) { if (request.request.slaveInfo.getAdditionalURIs() != null) { for (MesosSlaveInfo.URI uri : request.request.slaveInfo.getAdditionalURIs()) { commandBuilder.addUris( CommandInfo.URI.newBuilder().setValue( uri.getValue()).setExecutable(uri.isExecutable()).setExtract(uri.isExtract())); } } }
private Protos.CommandInfo.URI buildURI(final CloudAppConfiguration appConfig, final boolean isCommandExecutor) { Protos.CommandInfo.URI.Builder result = Protos.CommandInfo.URI.newBuilder().setValue(appConfig.getAppURL()).setCache(appConfig.isAppCacheEnable()); if (isCommandExecutor && !SupportedExtractionType.isExtraction(appConfig.getAppURL())) { result.setExecutable(true); } else { result.setExtract(true); } return result.build(); }
.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));