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

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

Introduction

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

Prototype

String FRAMEWORK_NAME

To view the source code for org.apache.hadoop.mapreduce MRConfig 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;
    }//www .  ja  va 2s  .c  o m

    // 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 ww .  java2  s  .c om*/
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$
    }/*  w  w  w.j ava 2s .  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/*from w w  w .j a v  a 2  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);
}

From source file:com.scaleoutsoftware.soss.hserver.hadoop.HServerClientProtocolProvider.java

License:Apache License

@Override
public ClientProtocol create(Configuration configuration) throws IOException {
    if (HSERVER_FRAMEWORK_NAME.equals(configuration.get(MRConfig.FRAMEWORK_NAME))) {
        return new HServerClientProtocol(configuration);
    }//www  .jav  a2 s .  c o  m
    return null;
}

From source file:org.apache.falcon.unit.LocalFalconClientProtocolProvider.java

License:Apache License

@Override
public ClientProtocol create(Configuration conf) throws IOException {
    String framework = conf.get(MRConfig.FRAMEWORK_NAME, UNIT);
    if (!UNIT.equals(framework)) {
        return null;
    }/*from   w  w  w .  ja v  a  2 s  . co m*/
    return getLocalJobRunner(conf);
}

From source file:org.apache.ignite.client.hadoop.GridHadoopClientProtocolProvider.java

License:Apache License

/** {@inheritDoc} */
@Override/*w ww. j  a va  2 s  .co  m*/
public ClientProtocol create(Configuration conf) throws IOException {
    if (FRAMEWORK_NAME.equals(conf.get(MRConfig.FRAMEWORK_NAME))) {
        String addr = conf.get(MRConfig.MASTER_ADDRESS);

        if (F.isEmpty(addr))
            throw new IOException(
                    "Failed to create client protocol because server address is not specified (is "
                            + MRConfig.MASTER_ADDRESS + " property set?).");

        if (F.eq(addr, "local"))
            throw new IOException("Local execution mode is not supported, please point "
                    + MRConfig.MASTER_ADDRESS + " to real Ignite node.");

        return createProtocol(addr, conf);
    }

    return null;
}

From source file:org.apache.ignite.client.hadoop.GridHadoopClientProtocolProvider.java

License:Apache License

/** {@inheritDoc} */
@Override//from   w w w. ja v  a 2  s  .c  om
public ClientProtocol create(InetSocketAddress addr, Configuration conf) throws IOException {
    if (FRAMEWORK_NAME.equals(conf.get(MRConfig.FRAMEWORK_NAME)))
        return createProtocol(addr.getHostString() + ":" + addr.getPort(), conf);

    return null;
}

From source file:org.apache.ignite.client.hadoop.GridHadoopClientProtocolSelfTest.java

License:Apache License

/**
 * @return Configuration.// w ww .java2  s . co  m
 */
private Configuration config(int port) {
    Configuration conf = new Configuration();

    setupFileSystems(conf);

    conf.set(MRConfig.FRAMEWORK_NAME, GridHadoopClientProtocol.FRAMEWORK_NAME);
    conf.set(MRConfig.MASTER_ADDRESS, "127.0.0.1:" + port);

    conf.set("fs.defaultFS", "igfs://:" + getTestGridName(0) + "@/");

    return conf;
}

From source file:org.apache.ignite.client.hadoop.HadoopClientProtocolSelfTest.java

License:Apache License

/**
 * @return Configuration./*from w ww. jav  a2s  .c o  m*/
 */
private Configuration config(int port) {
    Configuration conf = new Configuration();

    setupFileSystems(conf);

    conf.set(MRConfig.FRAMEWORK_NAME, IgniteHadoopClientProtocolProvider.FRAMEWORK_NAME);
    conf.set(MRConfig.MASTER_ADDRESS, "127.0.0.1:" + port);

    conf.set("fs.defaultFS", "igfs://:" + getTestGridName(0) + "@/");

    return conf;
}