use of io.mantisrx.runtime.Job in project mantis by Netflix.
the class LoadValidateCreateDir method execute.
@SuppressWarnings("rawtypes")
@Override
public void execute() throws CommandException {
File dir = new File(jarPath);
File[] directoryListing = dir.listFiles();
if (directoryListing != null) {
for (File child : directoryListing) {
System.out.println("================================");
// Absolute Path
System.out.println("Absolute Path:" + child.getAbsolutePath());
// File name only
System.out.println("File name only:" + child.getName());
// JSON file name
File fileLoop = new File(child.getAbsolutePath());
System.out.println("Dirname: " + fileLoop.getParent());
System.out.println("Basename: " + fileLoop.getName());
String fileBase = fileLoop.getName().substring(0, fileLoop.getName().lastIndexOf("."));
String fileExtension = fileLoop.getName().substring(fileLoop.getName().lastIndexOf(".") + 1, fileLoop.getName().length());
String jsonFile = fileBase + ".json";
String fileVersion = fileLoop.getName().substring(fileLoop.getName().lastIndexOf("-") + 1, fileLoop.getName().lastIndexOf("."));
System.out.println("fileBase: " + fileBase);
System.out.println("fileExtension: " + fileExtension);
System.out.println("jsonFile: " + jsonFile);
System.out.println("fileVersion: " + fileVersion);
try {
ReadJobFromJar readCommand = new ReadJobFromJar(child.getAbsolutePath());
readCommand.execute();
Job job = readCommand.getJob();
new ValidateJob(job).execute();
File jobDescriptor = new File(fileLoop.getParent() + "/" + jsonFile);
new CreateJobDescriptorFile(job, jobDescriptor, fileVersion, fileBase).execute();
} catch (Exception e) {
System.out.println("Got an error " + e.toString());
System.exit(1);
}
System.out.println("================================");
}
} else {
// Handle the case where dir is not really a directory.
// Checking dir.isDirectory() above would not be sufficient
// to avoid race conditions with another process that deletes
// directories.
System.out.println("not a dir");
System.exit(1);
}
// ReadJobFromJar readCommand = new ReadJobFromJar(jobJarFile);
// readCommand.execute();
// Job job = readCommand.getJob();
// new ValidateJob(job).execute();
// File jobDescriptor = new File(outputLocation+"/"+artifactName+"-"+version+".json");
// new CreateJobDescriptorFile(job, jobDescriptor, version, project).execute();
// new CreateZipFile(new File(outputLocation+"/"+artifactName+"-"+version+".mantis")
// , new File(jobJarFile), jobDescriptor).execute();
}
use of io.mantisrx.runtime.Job in project mantis by Netflix.
the class LoadValidateCreate method execute.
@SuppressWarnings("rawtypes")
@Override
public void execute() throws CommandException {
ReadJobFromJar readCommand = new ReadJobFromJar(jobJarFile);
readCommand.execute();
Job job = readCommand.getJob();
new ValidateJob(job).execute();
File jobDescriptor = new File(outputLocation + "/" + artifactName + "-" + version + ".json");
new CreateJobDescriptorFile(job, jobDescriptor, version, project).execute();
new CreateZipFile(new File(outputLocation + "/" + artifactName + "-" + version + ".mantis"), new File(jobJarFile), jobDescriptor).execute();
}
use of io.mantisrx.runtime.Job in project mantis by Netflix.
the class LoadValidateCreateZip method execute.
@SuppressWarnings("rawtypes")
@Override
public void execute() throws CommandException {
ReadJobFromZip readCommand = new ReadJobFromZip(jobZipFile, artifactName, version);
readCommand.execute();
Job job = readCommand.getJob();
new ValidateJob(job).execute();
File jobDescriptor = new File(outputLocation + "/" + artifactName + "-" + version + ".json");
new CreateJobDescriptorFile(job, jobDescriptor, version, artifactName, readyForJobMaster).execute();
}
use of io.mantisrx.runtime.Job in project mantis by Netflix.
the class StageExecutorsSingleStageTest method testSingleStageJob.
@SuppressWarnings("rawtypes")
@Test
public void testSingleStageJob() {
Action0 noOpAction = new Action0() {
@Override
public void call() {
}
};
Action1<Throwable> noOpError = new Action1<Throwable>() {
@Override
public void call(Throwable t) {
}
};
TestJobSingleStage provider = new TestJobSingleStage();
Job job = provider.getJobInstance();
PortSelector portSelector = new PortSelectorInRange(8000, 9000);
StageConfig<?, ?> stage = (StageConfig<?, ?>) job.getStages().get(0);
BehaviorSubject<Integer> workersInStageOneObservable = BehaviorSubject.create(1);
StageExecutors.executeSingleStageJob(job.getSource(), stage, job.getSink(), portSelector, new RxMetrics(), new Context(), noOpAction, 0, workersInStageOneObservable, null, null, noOpAction, noOpError);
Iterator<Integer> iter = provider.getItemsWritten().iterator();
Assert.assertEquals(0, iter.next().intValue());
Assert.assertEquals(1, iter.next().intValue());
Assert.assertEquals(4, iter.next().intValue());
Assert.assertEquals(9, iter.next().intValue());
}