use of com.netflix.titus.api.jobmanager.store.JobStore in project titus-control-plane by Netflix.
the class CassandraJobStoreTest method testRetrieveArchivedJob.
private void testRetrieveArchivedJob(boolean archive) {
JobStore store = getJobStore();
Job<BatchJobExt> job = createFinishedBatchJobObject();
store.init().await();
store.storeJob(job).await();
if (archive) {
store.deleteJob(job).await();
}
Job archivedJob = store.retrieveArchivedJob(job.getId()).toBlocking().first();
checkRetrievedJob(job, archivedJob);
}
use of com.netflix.titus.api.jobmanager.store.JobStore in project titus-control-plane by Netflix.
the class CassandraJobStoreTest method testRetrieveArchivedTaskCountForJob.
@Test
public void testRetrieveArchivedTaskCountForJob() {
JobStore store = getJobStore();
Job<BatchJobExt> job = createFinishedBatchJobObject();
store.init().await();
store.storeJob(job).await();
Pair<List<Job<?>>, Integer> jobsAndErrors = store.retrieveJobs().toBlocking().first();
checkRetrievedJob(job, jobsAndErrors.getLeft().get(0));
Task task = createFinishedTaskObject(job);
store.storeTask(task).await();
store.deleteTask(task).await();
Long count = store.retrieveArchivedTaskCountForJob(job.getId()).toBlocking().first();
assertThat(count).isEqualTo(1);
}
use of com.netflix.titus.api.jobmanager.store.JobStore in project titus-control-plane by Netflix.
the class CassandraJobStoreTest method testDeleteArchivedTask.
@Test
public void testDeleteArchivedTask() {
JobStore store = getJobStore();
Job<BatchJobExt> job = createFinishedBatchJobObject();
store.init().await();
store.storeJob(job).await();
Pair<List<Job<?>>, Integer> jobsAndErrors = store.retrieveJobs().toBlocking().first();
checkRetrievedJob(job, jobsAndErrors.getLeft().get(0));
Task task = createFinishedTaskObject(job);
store.storeTask(task).await();
store.deleteTask(task).await();
Long count = store.retrieveArchivedTaskCountForJob(job.getId()).toBlocking().first();
assertThat(count).isEqualTo(1);
store.deleteArchivedTask(job.getId(), task.getId()).await();
Long count2 = store.retrieveArchivedTaskCountForJob(job.getId()).toBlocking().first();
assertThat(count2).isEqualTo(0);
}
use of com.netflix.titus.api.jobmanager.store.JobStore in project titus-control-plane by Netflix.
the class CassandraJobStoreTest method testStoreJob.
@Test
public void testStoreJob() {
JobStore store = getJobStore();
Job<BatchJobExt> job = createBatchJobObject();
store.init().await();
store.storeJob(job).await();
Pair<List<Job<?>>, Integer> jobsAndErrors = store.retrieveJobs().toBlocking().first();
checkRetrievedJob(job, jobsAndErrors.getLeft().get(0));
}
use of com.netflix.titus.api.jobmanager.store.JobStore in project titus-control-plane by Netflix.
the class CassandraJobStoreTest method testRetrieveTask.
@Test
public void testRetrieveTask() {
JobStore store = getJobStore();
Job<BatchJobExt> job = createBatchJobObject();
store.init().await();
store.storeJob(job).await();
Pair<List<Job<?>>, Integer> jobsAndErrors = store.retrieveJobs().toBlocking().first();
checkRetrievedJob(job, jobsAndErrors.getLeft().get(0));
Task task = createTaskObject(job);
store.storeTask(task).await();
Task retrievedTask = store.retrieveTask(task.getId()).toBlocking().first();
checkRetrievedTask(task, retrievedTask);
// Check that archive access does not return anything.
try {
store.retrieveArchivedTask(task.getId()).toBlocking().first();
fail("Should not return active task");
} catch (JobStoreException e) {
assertThat(e.getErrorCode()).isEqualTo(JobStoreException.ErrorCode.TASK_DOES_NOT_EXIST);
}
}
Aggregations