Search in sources :

Example 1 with IContainer

use of edu.iu.dsc.tws.rsched.spi.container.IContainer in project twister2 by DSC-SPIDAL.

the class KubernetesWorker method startContainerClass.

/**
 * start the container class specified in conf files
 */
public static void startContainerClass() {
    String containerClass = SchedulerContext.containerClass(config);
    // String containerClass = "edu.iu.dsc.tws.examples.basic.BasicK8sContainer";
    IContainer container;
    try {
        Object object = ReflectionUtils.newInstance(containerClass);
        container = (IContainer) object;
        LOG.info("loaded container class: " + containerClass);
    } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) {
        LOG.log(Level.SEVERE, String.format("failed to load the container class %s", containerClass), e);
        throw new RuntimeException(e);
    }
    container.init(config, containerID, null);
}
Also used : IContainer(edu.iu.dsc.tws.rsched.spi.container.IContainer)

Example 2 with IContainer

use of edu.iu.dsc.tws.rsched.spi.container.IContainer in project twister2 by DSC-SPIDAL.

the class AuroraWorker method main.

public static void main(String[] args) {
    // create the worker
    AuroraWorker worker = createAuroraWorker();
    // get the number of workers from some where
    // wait for all of them
    // print their list and exit
    worker.waitAndGetAllWorkers();
    String containerClass = SchedulerContext.containerClass(worker.config);
    IContainer container;
    try {
        Object object = ReflectionUtils.newInstance(containerClass);
        container = (IContainer) object;
        LOG.info("loaded container class: " + containerClass);
    } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) {
        LOG.log(Level.SEVERE, String.format("failed to load the container class %s", containerClass), e);
        throw new RuntimeException(e);
    }
    container.init(worker.config, worker.zkController.getWorkerNetworkInfo().getWorkerID(), null);
    // close the things, let others know that it is done
    worker.close();
}
Also used : IContainer(edu.iu.dsc.tws.rsched.spi.container.IContainer)

Example 3 with IContainer

use of edu.iu.dsc.tws.rsched.spi.container.IContainer in project twister2 by DSC-SPIDAL.

the class MPIProcess method worker.

private static void worker(Config config, int rank) {
    // lets create the resource plan
    ResourcePlan resourcePlan = createResourcePlan(config);
    String containerClass = MPIContext.containerClass(config);
    IContainer container;
    try {
        Object object = ReflectionUtils.newInstance(containerClass);
        container = (IContainer) object;
        LOG.log(Level.FINE, "loaded container class: " + containerClass);
    } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) {
        LOG.log(Level.SEVERE, String.format("failed to load the container class %s", containerClass), e);
        throw new RuntimeException(e);
    }
    // lets do a barrier here so everyone is synchronized at the start
    try {
        MPI.COMM_WORLD.barrier();
        LOG.log(Level.FINE, String.format("Worker %d: the cluster is ready...", rank));
    } catch (MPIException e) {
        LOG.log(Level.SEVERE, "Failed to synchronize the workers at the start");
        throw new RuntimeException(e);
    }
    // now initialize the container
    container.init(config, rank, resourcePlan);
}
Also used : MPIException(mpi.MPIException) ResourcePlan(edu.iu.dsc.tws.rsched.spi.resource.ResourcePlan) IContainer(edu.iu.dsc.tws.rsched.spi.container.IContainer)

Aggregations

IContainer (edu.iu.dsc.tws.rsched.spi.container.IContainer)3 ResourcePlan (edu.iu.dsc.tws.rsched.spi.resource.ResourcePlan)1 MPIException (mpi.MPIException)1