use of io.pravega.test.system.framework.metronome.model.v1.Job in project pravega by pravega.
the class RemoteSequential method newJob.
private Job newJob(String id, String className, String methodName) {
Map<String, String> labels = new HashMap<>(1);
labels.put("testMethodName", methodName);
// This can be used to set environment variables while executing the job on Metronome.
Map<String, String> env = new HashMap<>(2);
env.put("masterIP", System.getProperty("masterIP"));
env.put("env2", "value102");
Artifact art = new Artifact();
// It caches the artifacts, disabling it for now.
art.setCache(false);
// jar is not executable.
art.setExecutable(false);
art.setExtract(false);
art.setUri(System.getProperty("testArtifactUrl", "InvalidTestArtifactURL"));
Restart restart = new Restart();
// the tests are expected to finish in 2 mins, this can be changed to
restart.setActiveDeadlineSeconds(120);
// a higher value if required.
restart.setPolicy("NEVER");
Run run = new Run();
run.setArtifacts(Collections.singletonList(art));
run.setCmd("docker run --rm -v $(pwd):/data " + System.getProperty("dockerImageRegistry") + "/java:8 java" + " -DmasterIP=" + LoginClient.MESOS_MASTER + " -DskipServiceInstallation=" + Utils.isSkipServiceInstallationEnabled() + " -cp /data/pravega-test-system-" + System.getProperty("testVersion") + ".jar io.pravega.test.system.SingleJUnitTestRunner " + className + "#" + methodName + " > server.log 2>&1" + "; exit $?");
// CPU shares.
run.setCpus(0.5);
// amount of memory required for running test in MB.
run.setMem(512.0);
run.setDisk(50.0);
run.setEnv(env);
run.setMaxLaunchDelay(3600);
run.setRestart(restart);
run.setUser("root");
Job job = new Job();
job.setId(id);
job.setDescription(id);
job.setLabels(labels);
job.setRun(run);
return job;
}
use of io.pravega.test.system.framework.metronome.model.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;
}
Aggregations