Example usage for org.apache.hadoop.mapreduce MRConfig LOCAL_FRAMEWORK_NAME

List of usage examples for org.apache.hadoop.mapreduce MRConfig LOCAL_FRAMEWORK_NAME

Introduction

In this page you can find the example usage for org.apache.hadoop.mapreduce MRConfig LOCAL_FRAMEWORK_NAME.

Prototype

String LOCAL_FRAMEWORK_NAME

To view the source code for org.apache.hadoop.mapreduce MRConfig LOCAL_FRAMEWORK_NAME.

Click Source Link

Usage

From source file:co.cask.cdap.internal.app.runtime.batch.inmemory.LocalClientProtocolProvider.java

License:Apache License

@Override
public ClientProtocol create(Configuration conf) throws IOException {
    String framework = conf.get(MRConfig.FRAMEWORK_NAME, MRConfig.LOCAL_FRAMEWORK_NAME);
    LOG.info("Using framework: " + framework);
    if (!MRConfig.LOCAL_FRAMEWORK_NAME.equals(framework)) {
        return null;
    }//from   w w w.  ja  v  a  2 s. com

    // We have to use something unique like "clocal" to make sure Hadoop's LocalClientProtocolProvider will fail to
    // provide the ClientProtocol
    String tracker = conf.get(JTConfig.JT_IPC_ADDRESS, "clocal");
    LOG.info("Using tracker: " + tracker);

    if ("clocal".equals(tracker)) {
        conf.setInt("mapreduce.job.maps", 1);
        return new LocalJobRunnerWithFix(conf);
    } else {

        throw new IOException("Invalid \"" + JTConfig.JT_IPC_ADDRESS
                + "\" configuration value for LocalJobRunner : \"" + tracker + "\"");
    }
}

From source file:co.cask.cdap.internal.app.runtime.batch.MapReduceContextProvider.java

License:Apache License

/**
 * Helper method to tell if the MR is running in local mode or not. This method doesn't really belongs to this
 * class, but currently there is no better place for it.
 *///from   w w w.  j  av a 2s.c o m
static boolean isLocal(Configuration hConf) {
    String mrFramework = hConf.get(MRConfig.FRAMEWORK_NAME, MRConfig.LOCAL_FRAMEWORK_NAME);
    return MRConfig.LOCAL_FRAMEWORK_NAME.equals(mrFramework);
}

From source file:com.asakusafw.runtime.compatibility.hadoop2.JobCompatibilityHadoop2.java

License:Apache License

@Override
public boolean isLocalMode(JobContext context) {
    if (context == null) {
        throw new IllegalArgumentException("context must not be null"); //$NON-NLS-1$
    }/*from  ww  w  . j  a  v a 2 s .c om*/
    if (isMRv1()) {
        return isLocalModeMRv1(context);
    }
    if (LOG.isDebugEnabled()) {
        LOG.debug(MessageFormat.format("{0}={1}", //$NON-NLS-1$
                MRConfig.FRAMEWORK_NAME, context.getConfiguration().get(MRConfig.FRAMEWORK_NAME)));
    }
    String name = context.getConfiguration().get(MRConfig.FRAMEWORK_NAME, MRConfig.LOCAL_FRAMEWORK_NAME);
    return name.equals(MRConfig.LOCAL_FRAMEWORK_NAME);
}

From source file:com.asakusafw.runtime.stage.StageUtil.java

License:Apache License

/**
 * Returns whether the current job is on the local mode or not.
 * @param context the current context//  w w w. ja v a2 s.c o m
 * @return {@code true} if the target job is running on the local mode, otherwise {@code false}
 * @throws IllegalArgumentException if some parameters were {@code null}
 * @since 0.6.2
 */
public static boolean isLocalMode(JobContext context) {
    if (context == null) {
        throw new IllegalArgumentException("context must not be null"); //$NON-NLS-1$
    }
    if (LOG.isDebugEnabled()) {
        LOG.debug(MessageFormat.format("{0}={1}", //$NON-NLS-1$
                MRConfig.FRAMEWORK_NAME, context.getConfiguration().get(MRConfig.FRAMEWORK_NAME)));
    }
    String name = context.getConfiguration().get(MRConfig.FRAMEWORK_NAME, MRConfig.LOCAL_FRAMEWORK_NAME);
    return name.equals(MRConfig.LOCAL_FRAMEWORK_NAME);
}