private Set<String> validateJobName(final JobId jobId, final JobId recomputedId) { final Set<String> errors = Sets.newHashSet(); final String jobIdName = jobId.getName(); if (isNullOrEmpty(jobIdName)) { errors.add("Job name was not specified."); return errors; } // Check that the job name contains only allowed characters if (!NAME_VERSION_PATTERN.matcher(jobIdName).matches()) { errors.add(format("Job name may only contain [0-9a-zA-Z-_.] in job name [%s].", recomputedId.getName())); } // Check that the job id is correct if (!recomputedId.getName().equals(jobIdName)) { errors.add(format("Id name mismatch: %s != %s", jobIdName, recomputedId.getName())); } return errors; }
protected String createJobRawOutput(final Job job) throws Exception { final String name = job.getId().getName(); checkArgument(name.contains(testTag), "Job name must contain testTag to enable cleanup"); final String serializedConfig = Json.asNormalizedString(job); final File configFile = temporaryFolder.newFile(); Files.write(serializedConfig, configFile, Charsets.UTF_8); final List<String> args = ImmutableList.of("-q", "-f", configFile.getAbsolutePath()); return cli("create", args); }
public static String configJobRefShort(final JobId id) { return CONFIG_JOBREFS.path(id.getName() + ":" + id.getVersion()); }
final String env = Joiner.on(" ").withKeyValueSeparator("=").join(job.getEnv()); final JobStatus status = jobStatuses.get(jobId); table.row(full ? jobId : jobId.toShortString(), jobId.getName(), jobId.getVersion(), status != null ? status.getDeployments().keySet().size() : 0, command, env);
final Job job = jobs.get(jobId); assertEquals(name, job.getId().getName()); assertEquals(version, job.getId().getVersion()); assertEquals(ports, job.getPorts());
builder.setName(id.getName()) .setVersion(id.getVersion());
public static String configJobRefShort(final JobId id) { return CONFIG_JOBREFS.path(id.getName() + ":" + id.getVersion()); }
private void outputDeployedMessage(final String host, final String containerId) { final StrSubstitutor subst = new StrSubstitutor(new ImmutableMap.Builder<String, Object>() .put("host", host) .put("name", job.getId().getName()) .put("version", job.getId().getVersion()) .put("hash", job.getId().getHash()) .put("job", job.toString()) .put("containerId", containerId) .build() ); log.info("{}", subst.replace(jobDeployedMessageFormat)); } }
final JobId jobId = entry.getKey(); if (!jobId.getName().startsWith(prefixFile.prefix())) { continue;
final String env = Joiner.on(" ").withKeyValueSeparator("=").join(job.getEnv()); final JobStatus status = futures.get(jobId).get(); table.row(full ? jobId : jobId.toShortString(), jobId.getName(), jobId.getVersion(), status != null ? status.getDeployments().keySet().size() : 0, command, env);