Search in sources :

Example 1 with LocalAlluxioCluster

use of alluxio.master.LocalAlluxioCluster in project zeppelin by apache.

the class AlluxioInterpreterTest method before.

@Before
public final void before() throws Exception {
    mLocalAlluxioCluster = new LocalAlluxioCluster(SIZE_BYTES, 1000);
    mLocalAlluxioCluster.start();
    fs = mLocalAlluxioCluster.getClient();
    final Properties props = new Properties();
    props.put(AlluxioInterpreter.ALLUXIO_MASTER_HOSTNAME, mLocalAlluxioCluster.getMasterHostname());
    props.put(AlluxioInterpreter.ALLUXIO_MASTER_PORT, mLocalAlluxioCluster.getMasterPort() + "");
    alluxioInterpreter = new AlluxioInterpreter(props);
    alluxioInterpreter.open();
}
Also used : LocalAlluxioCluster(alluxio.master.LocalAlluxioCluster) Properties(java.util.Properties)

Example 2 with LocalAlluxioCluster

use of alluxio.master.LocalAlluxioCluster in project alluxio by Alluxio.

the class LocalAlluxioClusterResource method apply.

@Override
public Statement apply(final Statement statement, Description description) {
    mLocalAlluxioCluster = new LocalAlluxioCluster(mNumWorkers);
    try {
        boolean startCluster = mStartCluster;
        Annotation configAnnotation = description.getAnnotation(Config.class);
        if (configAnnotation != null) {
            Config config = (Config) configAnnotation;
            // Override the configuration parameters with any configuration params
            for (int i = 0; i < config.confParams().length; i += 2) {
                mConfiguration.put(PropertyKey.fromString(config.confParams()[i]), config.confParams()[i + 1]);
            }
            // Override startCluster
            startCluster = config.startCluster();
        }
        if (startCluster) {
            start();
        }
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
    return new Statement() {

        @Override
        public void evaluate() throws Throwable {
            try {
                statement.evaluate();
            } finally {
                mLocalAlluxioCluster.stop();
            }
        }
    };
}
Also used : LocalAlluxioCluster(alluxio.master.LocalAlluxioCluster) Statement(org.junit.runners.model.Statement) Annotation(java.lang.annotation.Annotation)

Aggregations

LocalAlluxioCluster (alluxio.master.LocalAlluxioCluster)2 Annotation (java.lang.annotation.Annotation)1 Properties (java.util.Properties)1 Statement (org.junit.runners.model.Statement)1