use of edu.iu.dsc.tws.api.Twister2Job in project twister2 by DSC-SPIDAL.
the class BasicMesosJob method main.
public static void main(String[] args) {
Config config = ResourceAllocator.loadConfig(new HashMap<>());
System.out.println("read config values: " + config.size());
System.out.println(config);
String jobName = SchedulerContext.jobName(config);
jobName += "-" + System.currentTimeMillis();
System.out.println("job name is " + jobName);
// build JobConfig
HashMap<String, Object> configurations = new HashMap<>();
configurations.put(SchedulerContext.THREADS_PER_WORKER, 8);
JobConfig jobConfig = new JobConfig();
jobConfig.putAll(configurations);
// build the job
Twister2Job twister2Job = Twister2Job.loadTwister2Job(config, jobConfig);
twister2Job.setJobName(jobName);
// now submit the job
Twister2Submitter.submitJob(twister2Job, config);
System.out.println("now terminating...");
Twister2Submitter.terminateJob(twister2Job.getJobName(), config);
}
use of edu.iu.dsc.tws.api.Twister2Job in project twister2 by DSC-SPIDAL.
the class K8sControllerExample method main.
public static void main(String[] args) throws InterruptedException {
KubernetesController controller = KubernetesController.init("default");
if (args.length != 1) {
LOG.severe("Provide jobID as a parameter.");
return;
}
String jobID = args[0];
String configDir = "";
String twister2Home = Paths.get(configDir).toAbsolutePath().toString();
Config config = ConfigLoader.loadConfig(twister2Home, "conf", "kubernetes");
LOG.info("Loaded: " + config.size() + " configuration parameters.");
testUploader(config, controller, jobID);
if (config != null) {
controller.close();
return;
}
int numberOfWorkers = 4;
Twister2Job twister2Job = Twister2Job.newBuilder().setJobName("hello-world-job").setWorkerClass(HelloWorld.class).addComputeResource(.2, 128, numberOfWorkers).setConfig(new JobConfig()).build();
twister2Job.setUserName("au");
JobAPI.Job job = twister2Job.serialize();
LOG.info("jobID: " + job.getJobId());
V1ConfigMap cm = controller.getJobConfigMap(job.getJobId());
if (cm == null) {
LOG.info("there is no cm for this job on k8s");
} else {
LOG.info("cm: " + cm.getMetadata().getName());
}
// testPVC(config, controller, jobID);
createCM(controller, job);
getJobFromConfigMap(controller, job.getJobId());
// testWorker(controller, jobID, 0);
// testWorker(controller, jobID, 1);
// testWorker(controller, jobID, 3);
// testJM(controller, jobID);
// controller.addParamToConfigMap(jobID, "KILL_JOB", "true");
// Thread.sleep(5000);
// createCMWatcher(controller, jobID);
// Thread.sleep(5000);
controller.deleteConfigMap(job.getJobId());
controller.close();
}
use of edu.iu.dsc.tws.api.Twister2Job in project twister2 by DSC-SPIDAL.
the class TSetCommunicationExample method main.
public static void main(String[] args) {
JobConfig jobConfig = new JobConfig();
Twister2Job job = Twister2Job.newBuilder().setJobName(TSetCommunicationExample.class.getName()).setConfig(jobConfig).setWorkerClass(TSetCommunicationExample.class).addComputeResource(1, 512, 4).build();
Twister2Submitter.submitJob(job);
}
use of edu.iu.dsc.tws.api.Twister2Job in project twister2 by DSC-SPIDAL.
the class HelloTwister2 method main.
public static void main(String[] args) {
JobConfig jobConfig = new JobConfig();
Twister2Job job = Twister2Job.newBuilder().setJobName("hello-twister2").setConfig(jobConfig).setWorkerClass(HelloTwister2.class).addComputeResource(1, 512, 4).build();
Twister2Submitter.submitJob(job);
}
use of edu.iu.dsc.tws.api.Twister2Job in project twister2 by DSC-SPIDAL.
the class TSetTeraSort method main.
public static void main(String[] args) {
if (args.length < 2) {
LOG.warning("Missing arguments. Expected <parallelism> <data size>");
}
int parallelism = Integer.parseInt(args[0]);
int dataSize = Integer.parseInt(args[1]);
LOG.info(String.format("Data Size : %d, Parallelism : %d", dataSize, parallelism));
JobConfig jobConfig = new JobConfig();
jobConfig.put(PARAM_PARALLELISM, parallelism);
jobConfig.put(PARAM_DATA_SIZE_GB, dataSize);
Twister2Job job = Twister2Job.newBuilder().setJobName(TSetTeraSort.class.getName()).setConfig(jobConfig).setWorkerClass(TSetTeraSort.class).addComputeResource(1, 512, 4).build();
Twister2Submitter.submitJob(job);
}
Aggregations