use of com.netflix.titus.api.jobmanager.model.job.ext.BatchJobExt in project titus-control-plane by Netflix.
the class CassandraJobStoreTest method testDeleteJob.
@Test
public void testDeleteJob() {
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));
store.deleteJob(job).await();
jobsAndErrors = store.retrieveJobs().toBlocking().first();
assertThat(jobsAndErrors.getLeft()).isEmpty();
}
use of com.netflix.titus.api.jobmanager.model.job.ext.BatchJobExt in project titus-control-plane by Netflix.
the class TestStoreLoadCommand method createJobObject.
private Job<BatchJobExt> createJobObject() {
String jobId = UUID.randomUUID().toString();
JobDescriptor<BatchJobExt> jobDescriptor = JobDescriptor.<BatchJobExt>newBuilder().withExtensions(new BatchJobExt(1, 1, null, false)).build();
JobStatus status = new JobStatus(Accepted, "code", "message", System.currentTimeMillis());
return new Job<>(jobId, jobDescriptor, status, new ArrayList<>(), Version.undefined());
}
use of com.netflix.titus.api.jobmanager.model.job.ext.BatchJobExt in project titus-control-plane by Netflix.
the class JobModelSanitizationTest method testJobWithInvalidPlatformSidecar.
@Test
public void testJobWithInvalidPlatformSidecar() {
PlatformSidecar badPS = PlatformSidecar.newBuilder().withName("BAD_NAME").withChannel("BAD_CHANNEL").build();
JobDescriptor<BatchJobExt> badJobDescriptor = oneTaskBatchJobDescriptor().but(jd -> jd.toBuilder().withPlatformSidecars(Collections.singletonList(badPS)).build());
Set<ValidationError> violations = entitySanitizer.validate(badJobDescriptor);
assertThat(violations).hasSize(2);
}
use of com.netflix.titus.api.jobmanager.model.job.ext.BatchJobExt in project titus-control-plane by Netflix.
the class JobModelSanitizationTest method testJobWithInvalidVolume.
@Test
public void testJobWithInvalidVolume() {
VolumeSource vs = new SaaSVolumeSource("BAD_SAAS_NAME");
Volume badVolume = Volume.newBuilder().withName("BAD_NAME").withVolumeSource(vs).build();
JobDescriptor<BatchJobExt> badJobDescriptor = oneTaskBatchJobDescriptor().but(jd -> jd.toBuilder().withVolumes(Collections.singletonList(badVolume)).build());
Set<ValidationError> violations = entitySanitizer.validate(badJobDescriptor);
assertThat(violations).hasSize(2);
}
use of com.netflix.titus.api.jobmanager.model.job.ext.BatchJobExt in project titus-control-plane by Netflix.
the class JobDescriptorGenerator method oneTaskBatchJobDescriptor.
public static JobDescriptor<BatchJobExt> oneTaskBatchJobDescriptor() {
JobDescriptor<BatchJobExt> jobDescriptor = batchJobDescriptors().getValue();
Image imageWithTag = JobModel.newImage().withName("titusops/alpine").withTag("latest").build();
return JobModel.newJobDescriptor(jobDescriptor).withContainer(JobModel.newContainer(jobDescriptor.getContainer()).withImage(imageWithTag).build()).withDisruptionBudget(DisruptionBudgetGenerator.budget(DisruptionBudgetGenerator.perTaskRelocationLimitPolicy(3), DisruptionBudgetGenerator.hourlyRatePercentage(50), Collections.singletonList(DisruptionBudgetGenerator.officeHourTimeWindow()))).withExtensions(JobModel.newBatchJobExt(jobDescriptor.getExtensions()).withSize(1).withRetryPolicy(JobModel.newImmediateRetryPolicy().withRetries(0).build()).build()).withExtraContainers(jobDescriptor.getExtraContainers()).withPlatformSidecars(jobDescriptor.getPlatformSidecars()).build();
}
Aggregations