public static String configJobCreation(final JobId id, final UUID operationId) { final String name = CREATION_PREFIX + operationId; return CONFIG_JOBS.path(id.toString(), name); }
/** * Remove the {@link TaskStatus} for the job identified by {@code jobId}. */ @Override public void removeTaskStatus(final JobId jobId) throws InterruptedException { taskStatuses.remove(jobId.toString()); }
public static String historyJobHostEventsTimestamp(final JobId jobId, final String host, final long timestamp) { return HISTORY_JOBS.path(jobId.toString(), HOSTS, host, EVENTS, String.valueOf(timestamp)); }
public static String historyJobHost(final JobId jobId, final String host) { return HISTORY_JOBS.path(jobId.toString(), HOSTS, host); }
public static String configHostJobCreation(final String host, final JobId id, final UUID operationId) { return CONFIG_HOSTS.path(host, JOBS, id.toString(), CREATION_PREFIX + operationId); }
protected String stopJob(final JobId jobId, final String host) throws Exception { return cli("stop", jobId.toString(), host); }
public static String configHostJob(final String host, final JobId jobId) { return CONFIG_HOSTS.path(host, JOBS, jobId.toString()); }
public static String historyJobHostEvents(final JobId jobId, final String host) { return historyJobHostEvents(jobId.toString(), host); }
protected String startJob(final JobId jobId, final String host) throws Exception { return cli("start", jobId.toString(), host); }
public static String historyJobHosts(final JobId jobId) { return HISTORY_JOBS.path(jobId.toString(), HOSTS); }
public static String configJob(final JobId id) { return CONFIG_JOBS.path(id.toString()); }
public static String configJobHosts(final JobId jobId) { return CONFIG_JOBS.path(jobId.toString(), HOSTS); }
public static String configJobHost(final JobId jobId, final String host) { return CONFIG_JOBS.path(jobId.toString(), HOSTS, host); }
public static String statusHostJob(final String host, final JobId jobId) { return statusHostJob(host, jobId.toString()); }
public static String historyJob(final JobId jobId) { return HISTORY_JOBS.path(jobId.toString()); }
protected void deployJob(final JobId jobId, final String host, final String token) throws Exception { final List<String> deployArgs = Lists.newArrayList(jobId.toString(), host); if (token != null) { deployArgs.addAll(ImmutableList.of("--token", token)); } final String deployOutput = cli("deploy", deployArgs); assertThat(deployOutput, containsString(host + ": done")); final String output = cli("status", "--host", host, "--json"); final Map<JobId, JobStatus> statuses = Json.readUnchecked(output, new TypeReference<Map<JobId, JobStatus>>() { }); assertTrue(statuses.keySet().contains(jobId)); }
/** * Get the {@link TaskStatus} for the job identified by {@code jobId}. */ @Override public TaskStatus getTaskStatus(final JobId jobId) { final byte[] data = taskStatuses.get(jobId.toString()); if (data == null) { return null; } try { return parse(data, TaskStatus.class); } catch (IOException e) { throw new RuntimeException(e); } }
protected void undeployJob(final JobId jobId, final String host) throws Exception { final String undeployOutput = cli("undeploy", jobId.toString(), host); assertThat(undeployOutput, containsString(host + ": done")); final String output = cli("status", "--host", host, "--json"); final Map<JobId, JobStatus> statuses = Json.readUnchecked(output, new TypeReference<Map<JobId, JobStatus>>() { }); final JobStatus status = statuses.get(jobId); assertTrue(status == null || status.getDeployments().get(host) == null); }
public ListenableFuture<TaskStatusEvents> jobHistory(final JobId jobId) { return transformAsync( request(uri(path("/history/jobs/%s", jobId.toString())), "GET"), ConvertResponseToPojo.create(TaskStatusEvents.class, ImmutableSet.of(HTTP_OK, HTTP_NOT_FOUND)), MoreExecutors.directExecutor()); }
@Test public void testUndeployingNonexistantJobJson() throws Exception { startDefaultMaster(); // Wait for master to come up Polling.await(LONG_WAIT_SECONDS, SECONDS, new Callable<String>() { @Override public String call() throws Exception { final String output = cli("masters"); return output.contains(masterName()) ? output : null; } }); // Verify that undeploying a nonexistent job from a host fails final String output = cli("undeploy", "--json", BOGUS_JOB.toString(), testHost()); final JobDeployResponse jobDeployResponse = Json.read(output, JobDeployResponse.class); assertEquals(JobDeployResponse.Status.JOB_NOT_FOUND, jobDeployResponse.getStatus()); }