Example usage for org.apache.hadoop.mapred JobConf write

List of usage examples for org.apache.hadoop.mapred JobConf write

Introduction

In this page you can find the example usage for org.apache.hadoop.mapred JobConf write.

Prototype

@Override
    public void write(DataOutput out) throws IOException 

Source Link

Usage

From source file:edu.uci.ics.hyracks.hdfs.dataflow.ConfFactory.java

License:Apache License

public ConfFactory(JobConf conf) throws HyracksDataException {
    try {/* w  w w.  ja  va  2 s  .c  o  m*/
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        DataOutputStream dos = new DataOutputStream(bos);
        conf.write(dos);
        confBytes = bos.toByteArray();
        dos.close();
    } catch (Exception e) {
        throw new HyracksDataException(e);
    }
}

From source file:org.apache.ignite.internal.processors.hadoop.GridHadoopTestTaskContext.java

License:Apache License

/**
 * Creates DataInput to read JobConf./*  ww w . j ava  2s  .c  o  m*/
 *
 * @param job Job.
 * @return DataInput with JobConf.
 * @throws IgniteCheckedException If failed.
 */
private static DataInput jobConfDataInput(GridHadoopJob job) throws IgniteCheckedException {
    JobConf jobConf = new JobConf();

    for (Map.Entry<String, String> e : ((GridHadoopDefaultJobInfo) job.info()).properties().entrySet())
        jobConf.set(e.getKey(), e.getValue());

    ByteArrayOutputStream buf = new ByteArrayOutputStream();

    try {
        jobConf.write(new DataOutputStream(buf));
    } catch (IOException e) {
        throw new IgniteCheckedException(e);
    }

    return new DataInputStream(new ByteArrayInputStream(buf.toByteArray()));
}

From source file:org.apache.ignite.internal.processors.hadoop.HadoopTestTaskContext.java

License:Apache License

/**
 * Creates DataInput to read JobConf./*from  w  w w.  j  a  v  a  2 s. co  m*/
 *
 * @param job Job.
 * @return DataInput with JobConf.
 * @throws IgniteCheckedException If failed.
 */
private static DataInput jobConfDataInput(HadoopJob job) throws IgniteCheckedException {
    JobConf jobConf = new JobConf();

    for (Map.Entry<String, String> e : ((HadoopDefaultJobInfo) job.info()).properties().entrySet())
        jobConf.set(e.getKey(), e.getValue());

    ByteArrayOutputStream buf = new ByteArrayOutputStream();

    try {
        jobConf.write(new DataOutputStream(buf));
    } catch (IOException e) {
        throw new IgniteCheckedException(e);
    }

    return new DataInputStream(new ByteArrayInputStream(buf.toByteArray()));
}

From source file:org.apache.ignite.internal.processors.hadoop.impl.HadoopTestTaskContext.java

License:Apache License

/**
 * Creates DataInput to read JobConf.//from  www . j  a v a2 s . c  om
 *
 * @param job Job.
 * @return DataInput with JobConf.
 * @throws IgniteCheckedException If failed.
 */
private static DataInput jobConfDataInput(HadoopJobEx job) throws IgniteCheckedException {
    JobConf jobConf = new JobConf();

    for (Map.Entry<String, String> e : ((HadoopDefaultJobInfo) job.info()).properties().entrySet())
        jobConf.set(e.getKey(), e.getValue());

    ByteArrayOutputStream buf = new ByteArrayOutputStream();

    try {
        jobConf.write(new DataOutputStream(buf));
    } catch (IOException e) {
        throw new IgniteCheckedException(e);
    }

    return new DataInputStream(new ByteArrayInputStream(buf.toByteArray()));
}

From source file:org.gridgain.grid.kernal.processors.hadoop.GridHadoopTestTaskContext.java

License:Open Source License

/**
 * Creates DataInput to read JobConf.//w w  w. j a va  2  s  .c o m
 *
 * @param job Job.
 * @return DataInput with JobConf.
 * @throws GridException If failed.
 */
private static DataInput jobConfDataInput(GridHadoopJob job) throws GridException {
    JobConf jobConf = new JobConf();

    for (Map.Entry<String, String> e : ((GridHadoopDefaultJobInfo) job.info()).properties().entrySet())
        jobConf.set(e.getKey(), e.getValue());

    ByteArrayOutputStream buf = new ByteArrayOutputStream();

    try {
        jobConf.write(new DataOutputStream(buf));
    } catch (IOException e) {
        throw new GridException(e);
    }

    return new DataInputStream(new ByteArrayInputStream(buf.toByteArray()));
}