Search in sources :

Example 1 with IWorker

use of edu.iu.dsc.tws.api.resource.IWorker in project twister2 by DSC-SPIDAL.

the class MPIWorkerStarter method startWorker.

/**
 * start the Worker class specified in conf files
 */
public static boolean startWorker(IWorkerController workerController, IPersistentVolume pv, String podName) {
    IWorker worker = JobUtils.initializeIWorker(job);
    K8sVolatileVolume volatileVolume = null;
    if (computeResource.getDiskGigaBytes() > 0) {
        volatileVolume = new K8sVolatileVolume(jobID, workerID);
    }
    MPIWorkerManager mpiWorkerManager = new MPIWorkerManager();
    return mpiWorkerManager.execute(config, job, workerController, pv, volatileVolume, worker);
}
Also used : MPIWorkerManager(edu.iu.dsc.tws.rsched.worker.MPIWorkerManager) IWorker(edu.iu.dsc.tws.api.resource.IWorker) K8sVolatileVolume(edu.iu.dsc.tws.rsched.schedulers.k8s.worker.K8sVolatileVolume)

Example 2 with IWorker

use of edu.iu.dsc.tws.api.resource.IWorker in project twister2 by DSC-SPIDAL.

the class NomadWorkerStarter method startWorker.

private void startWorker() {
    LOG.log(Level.INFO, "A worker process is starting...");
    // lets create the resource plan
    this.workerController = createWorkerController();
    JobMasterAPI.WorkerInfo workerNetworkInfo = workerController.getWorkerInfo();
    try {
        LOG.log(Level.INFO, "Worker IP..:" + Inet4Address.getLocalHost().getHostAddress());
    } catch (UnknownHostException e) {
        e.printStackTrace();
    }
    try {
        List<JobMasterAPI.WorkerInfo> workerInfos = workerController.getAllWorkers();
    } catch (TimeoutException timeoutException) {
        LOG.log(Level.SEVERE, timeoutException.getMessage(), timeoutException);
        return;
    }
    IWorker worker = JobUtils.initializeIWorker(job);
    MPIWorkerManager workerManager = new MPIWorkerManager();
    workerManager.execute(config, job, workerController, null, null, worker);
}
Also used : JobMasterAPI(edu.iu.dsc.tws.proto.jobmaster.JobMasterAPI) UnknownHostException(java.net.UnknownHostException) MPIWorkerManager(edu.iu.dsc.tws.rsched.worker.MPIWorkerManager) IWorker(edu.iu.dsc.tws.api.resource.IWorker) TimeoutException(edu.iu.dsc.tws.api.exceptions.TimeoutException)

Example 3 with IWorker

use of edu.iu.dsc.tws.api.resource.IWorker in project twister2 by DSC-SPIDAL.

the class MesosDockerWorker method startWorker.

public static void startWorker(IWorkerController workerController, IPersistentVolume pv) {
    JobAPI.Job job = JobUtils.readJobFile("twister2-job/" + jobID + ".job");
    MesosVolatileVolume volatileVolume = null;
    // TODO method SchedulerContext.volatileDiskRequested deleted
    // volatileVolume needs to be checked from job object
    // if (SchedulerContext.volatileDiskRequested(config)) {
    // volatileVolume =
    // new MesosVolatileVolume(SchedulerContext.jobID(config), workerID);
    // }
    // lets create the resource plan
    // Map<Integer, String> processNames = MPIWorker.createResourcePlan(config);
    // now create the resource plan
    // AllocatedResources resourcePlan = MPIWorker.addContainers(config, processNames);
    // AllocatedResources resourcePlan = MesosWorkerUtils.createAllocatedResources("mesos",
    // workerID, job);
    // resourcePlan = new AllocatedResources(SchedulerContext.clusterType(config), workerID);
    IWorker worker = JobUtils.initializeIWorker(job);
    worker.execute(config, job, jobMasterAgent.getJMWorkerController(), pv, volatileVolume);
}
Also used : IWorker(edu.iu.dsc.tws.api.resource.IWorker) JobAPI(edu.iu.dsc.tws.proto.system.job.JobAPI)

Example 4 with IWorker

use of edu.iu.dsc.tws.api.resource.IWorker in project twister2 by DSC-SPIDAL.

the class AuroraWorkerStarter method main.

public static void main(String[] args) {
    // create the worker
    AuroraWorkerStarter workerStarter = createAuroraWorker();
    // get the number of workers from some where
    // wait for all of them
    // print their list and exit
    workerStarter.waitAndGetAllWorkers();
    String workerClass = SchedulerContext.workerClass(workerStarter.config);
    IWorker worker;
    try {
        Object object = ReflectionUtils.newInstance(workerClass);
        worker = (IWorker) object;
        LOG.info("loaded worker class: " + workerClass);
    } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) {
        LOG.log(Level.SEVERE, String.format("failed to load the worker class %s", workerClass), e);
        throw new RuntimeException(e);
    }
    // TODO: need to provide all parameters
    worker.execute(workerStarter.config, workerStarter.job, null, null, null);
    // close the things, let others know that it is done
    workerStarter.close();
}
Also used : IWorker(edu.iu.dsc.tws.api.resource.IWorker)

Example 5 with IWorker

use of edu.iu.dsc.tws.api.resource.IWorker in project twister2 by DSC-SPIDAL.

the class K8sWorkerStarter method startWorker.

/**
 * start the Worker class specified in conf files
 */
public static boolean startWorker(IWorkerController workerController, IPersistentVolume pv) {
    IWorker worker = JobUtils.initializeIWorker(job);
    K8sVolatileVolume volatileVolume = null;
    if (computeResource.getDiskGigaBytes() > 0) {
        volatileVolume = new K8sVolatileVolume(jobID, workerID);
    }
    WorkerManager workerManager = new WorkerManager(config, job, workerController, pv, volatileVolume, worker);
    return workerManager.execute();
}
Also used : WorkerManager(edu.iu.dsc.tws.rsched.worker.WorkerManager) IWorker(edu.iu.dsc.tws.api.resource.IWorker)

Aggregations

IWorker (edu.iu.dsc.tws.api.resource.IWorker)8 JobAPI (edu.iu.dsc.tws.proto.system.job.JobAPI)3 MPIWorkerManager (edu.iu.dsc.tws.rsched.worker.MPIWorkerManager)3 TimeoutException (edu.iu.dsc.tws.api.exceptions.TimeoutException)2 UnknownHostException (java.net.UnknownHostException)2 Twister2RuntimeException (edu.iu.dsc.tws.api.exceptions.Twister2RuntimeException)1 IPersistentVolume (edu.iu.dsc.tws.api.resource.IPersistentVolume)1 IWorkerController (edu.iu.dsc.tws.api.resource.IWorkerController)1 JobMasterAPI (edu.iu.dsc.tws.proto.jobmaster.JobMasterAPI)1 K8sVolatileVolume (edu.iu.dsc.tws.rsched.schedulers.k8s.worker.K8sVolatileVolume)1 MesosVolatileVolume (edu.iu.dsc.tws.rsched.schedulers.mesos.MesosVolatileVolume)1 WorkerManager (edu.iu.dsc.tws.rsched.worker.WorkerManager)1 MPIException (mpi.MPIException)1 Protos (org.apache.mesos.Protos)1