use of com.google.cloud.dataproc.v1beta2.JobStatus in project halyard by spinnaker.
the class VaultService method publishSecret.
public void publishSecret(DeploymentConfiguration deploymentConfiguration, String name, String contents) {
String vaultAddress = deploymentConfiguration.getDeploymentEnvironment().getVault().getAddress();
String encodedContents = Base64.getEncoder().encodeToString(contents.getBytes());
String secretName = vaultSecretPrefix + name;
List<String> command = new ArrayList<>();
command.add("vault");
command.add("write");
command.add("--address");
command.add(vaultAddress);
command.add(secretName);
command.add(encodedContents);
JobRequest request = new JobRequest().setTokenizedCommand(command).setTimeoutMillis(TimeUnit.SECONDS.toMillis(vaultTimeoutSeconds));
String id = jobExecutor.startJob(request);
DaemonTaskHandler.safeSleep(TimeUnit.SECONDS.toMillis(5));
JobStatus status = jobExecutor.updateJob(id);
if (!status.getResult().equals(JobStatus.Result.SUCCESS)) {
throw new HalException(Problem.Severity.FATAL, "Failed to publish secret " + name + ": " + status.getStdOut() + status.getStdErr());
}
}
use of com.google.cloud.dataproc.v1beta2.JobStatus in project strimzi-kafka-operator by strimzi.
the class JobUtils method waitForJobRunning.
/**
* Wait for specific Job Running active status
* @param jobName job name
* @param namespace namespace
*/
public static boolean waitForJobRunning(String jobName, String namespace) {
LOGGER.info("Waiting for job: {} will be in active state", jobName);
TestUtils.waitFor("job active", Constants.GLOBAL_POLL_INTERVAL, ResourceOperation.getTimeoutForResourceReadiness(Constants.JOB), () -> {
JobStatus jb = kubeClient().namespace(namespace).getJobStatus(jobName);
return jb.getActive() > 0;
});
return true;
}
use of com.google.cloud.dataproc.v1beta2.JobStatus in project pipelite by enasequence.
the class KubernetesExecutorTest method describeJobsStateError.
@Test
public void describeJobsStateError() {
JobStatus jobStatus = new JobStatus();
JobCondition jobCondition = new JobCondition();
jobCondition.setType("Failed");
jobCondition.setStatus("true");
jobStatus.setConditions(Arrays.asList(jobCondition));
assertThat(KubernetesExecutor.describeJobsResultFromStatus(jobStatus).isError()).isTrue();
}
use of com.google.cloud.dataproc.v1beta2.JobStatus in project pipelite by enasequence.
the class KubernetesExecutorTest method describeJobsStateActive.
@Test
public void describeJobsStateActive() {
JobStatus jobStatus = new JobStatus();
assertThat(KubernetesExecutor.describeJobsResultFromStatus(jobStatus).isActive()).isTrue();
jobStatus.setActive(1);
assertThat(KubernetesExecutor.describeJobsResultFromStatus(jobStatus).isActive()).isTrue();
}
Aggregations