use of com.google.cloud.video.transcoder.v1.Job in project jkube by eclipse.
the class JobHandlerTest method jobHandlerTest.
@Test
public void jobHandlerTest() {
ResourceConfig config = ResourceConfig.builder().imagePullPolicy("IfNotPresent").controllerName("testing").serviceAccount("test-account").restartPolicy("OnFailure").volumes(volumes1).build();
Job job = jobHandler.get(config, images);
// Assertion
assertNotNull(job.getSpec());
assertNotNull(job.getMetadata());
assertNotNull(job.getSpec().getTemplate());
assertEquals("testing", job.getMetadata().getName());
assertEquals("test-account", job.getSpec().getTemplate().getSpec().getServiceAccountName());
assertFalse(job.getSpec().getTemplate().getSpec().getVolumes().isEmpty());
assertEquals("OnFailure", job.getSpec().getTemplate().getSpec().getRestartPolicy());
assertEquals("test", job.getSpec().getTemplate().getSpec().getVolumes().get(0).getName());
assertEquals("/test/path", job.getSpec().getTemplate().getSpec().getVolumes().get(0).getHostPath().getPath());
assertNotNull(job.getSpec().getTemplate().getSpec().getContainers());
}
use of com.google.cloud.video.transcoder.v1.Job in project pravega by pravega.
the class RemoteSequential method isTestRunning.
private boolean isTestRunning(final String jobId, final Metronome client) {
Job jobStatus = client.getJob(jobId);
boolean isRunning = false;
if (jobStatus.getHistory() == null) {
isRunning = true;
} else if ((jobStatus.getHistory().getSuccessCount() == 0) && (jobStatus.getHistory().getFailureCount() == 0)) {
isRunning = true;
}
return isRunning;
}
use of com.google.cloud.video.transcoder.v1.Job in project pravega by pravega.
the class RemoteSequential method startTestExecution.
@Override
public CompletableFuture<Void> startTestExecution(Method testMethod) {
Exceptions.handleInterrupted(() -> TimeUnit.SECONDS.sleep(60));
// This will be removed once issue https://github.com/pravega/pravega/issues/1665 is resolved.
log.debug("Starting test execution for method: {}", testMethod);
final Metronome client = AuthEnabledMetronomeClient.getClient();
String className = testMethod.getDeclaringClass().getName();
String methodName = testMethod.getName();
// All jobIds should have lowercase for metronome.
String jobId = (methodName + ".testJob").toLowerCase();
return CompletableFuture.runAsync(() -> {
client.createJob(newJob(jobId, className, methodName));
Response response = client.triggerJobRun(jobId);
if (response.status() != CREATED.getStatusCode()) {
throw new TestFrameworkException(TestFrameworkException.Type.ConnectionFailed, "Error while starting " + "test " + testMethod);
} else {
log.info("Created job succeeded with: " + response.toString());
}
}).thenCompose(v2 -> waitForJobCompletion(jobId, client)).<Void>thenApply(v1 -> {
if (client.getJob(jobId).getHistory().getFailureCount() != 0) {
throw new AssertionError("Test failed, detailed logs can be found at " + "https://MasterIP/mesos, under metronome framework tasks. MethodName: " + methodName);
}
return null;
}).whenComplete((v, ex) -> {
// deletejob once execution is complete.
deleteJob(jobId, client);
if (ex != null) {
log.error("Error while executing the test. ClassName: {}, MethodName: {}", className, methodName);
}
});
}
use of com.google.cloud.video.transcoder.v1.Job in project pentaho-platform by pentaho.
the class SchedulerService method getContentCleanerJob.
public Job getContentCleanerJob() throws SchedulerException {
IPentahoSession session = getSession();
// this authentication wasn't matching with the job user name,
final String principalName = session.getName();
// changed to get name via the current session
final Boolean canAdminister = getPolicy().isAllowed(AdministerSecurityAction.NAME);
List<Job> jobs = getScheduler().getJobs(getJobFilter(canAdminister, principalName));
if (jobs.size() > 0) {
return jobs.get(0);
}
return null;
}
use of com.google.cloud.video.transcoder.v1.Job in project pentaho-platform by pentaho.
the class SchedulerService method triggerNow.
public Job triggerNow(String jobId) throws SchedulerException {
Job job = getScheduler().getJob(jobId);
if (getPolicy().isAllowed(SchedulerAction.NAME)) {
getScheduler().triggerNow(jobId);
} else {
if (getSession().getName().equals(job.getUserName())) {
getScheduler().triggerNow(jobId);
}
}
// udpate job state
job = getScheduler().getJob(jobId);
return job;
}
Aggregations