Search in sources :

Example 1 with OrbConfiguration

use of org.goldenorb.conf.OrbConfiguration in project goldenorb by jzachr.

the class OrbPartitionProcess method getLocalFilesPath.

/**
   * Calculates what the class paths for the distributed files that are in this partitions temp directory. All
   * files are distributed to /temp directory/GoldenOrb/jobNumber/file name.
   * 
   * @return A list of the class paths that need to be added to this partitions class path
   * @throws IOException
   * @throws InterruptedException
   * @throws OrbZKFailure
   */
private List<String> getLocalFilesPath() throws IOException, InterruptedException, OrbZKFailure {
    List<String> paths = null;
    ZooKeeper zk = ZookeeperUtils.connect(conf.getOrbZooKeeperQuorum());
    String zkPath = "/GoldenOrb/" + conf.getOrbClusterName() + "/JobQueue/" + jobNumber;
    logger.info("Getting node " + zkPath + " from ZooKeeper");
    OrbConfiguration orbConf = (OrbConfiguration) ZookeeperUtils.getNodeWritable(zk, zkPath, OrbConfiguration.class, conf);
    if (orbConf != null) {
        Path[] tempPaths = orbConf.getHDFSdistributedFiles();
        if (tempPaths != null) {
            paths = new ArrayList<String>();
            for (Path path : tempPaths) {
                String[] name = path.toString().split("/");
                // files are always put in /<temp directory>/GoldenOrb/<jobNumber>/<file name>
                paths.add(System.getProperty("java.io.tmpdir") + "/GoldenOrb/" + orbConf.getOrbClusterName() + "/" + jobNumber + "/" + name[name.length - 1]);
            }
        }
    }
    zk.close();
    return paths;
}
Also used : Path(org.apache.hadoop.fs.Path) ZooKeeper(org.apache.zookeeper.ZooKeeper) OrbConfiguration(org.goldenorb.conf.OrbConfiguration)

Example 2 with OrbConfiguration

use of org.goldenorb.conf.OrbConfiguration in project goldenorb by jzachr.

the class TestJobManager method setUp.

@BeforeClass
public static void setUp() throws IOException {
    OrbConfiguration orbConf = new OrbConfiguration(true);
    cluster = new MiniDFSCluster(orbConf, 3, true, null);
}
Also used : MiniDFSCluster(org.apache.hadoop.hdfs.MiniDFSCluster) OrbConfiguration(org.goldenorb.conf.OrbConfiguration) BeforeClass(org.junit.BeforeClass)

Example 3 with OrbConfiguration

use of org.goldenorb.conf.OrbConfiguration in project goldenorb by jzachr.

the class TestRunner method main.

/**
 * 
 * @param  String[] args
 */
public static void main(String[] args) {
    OrbRunner runner = new OrbRunner();
    runner.runJob(new OrbConfiguration(true));
}
Also used : OrbConfiguration(org.goldenorb.conf.OrbConfiguration)

Example 4 with OrbConfiguration

use of org.goldenorb.conf.OrbConfiguration in project goldenorb by jzachr.

the class TestInputSplitAllocatorDFS method testInputSplitAllocator.

@Test
public void testInputSplitAllocator() throws Exception {
    LOG = LoggerFactory.getLogger(TestInputSplitAllocatorDFS.class);
    fs.copyFromLocalFile(new Path("src/test/resources/InputSplitAllocatorDFSTestData.txt"), new Path("test/inpath"));
    OrbConfiguration orbConf = new OrbConfiguration(true);
    orbConf.set("fs.default.name", "hdfs://localhost:" + cluster.getNameNodePort());
    orbConf.setJobNumber("0");
    orbConf.setFileInputPath("test/inpath");
    orbConf.setNameNode("hdfs://localhost:" + cluster.getNameNodePort());
    String hostname = OrbDNS.getDefaultHost(orbConf);
    if (hostname.endsWith(".")) {
        hostname = hostname.substring(0, hostname.length() - 1);
    }
    OrbPartitionMember opm1 = new OrbPartitionMember();
    opm1.setHostname(hostname);
    opm1.setPort(0);
    OrbPartitionMember opm2 = new OrbPartitionMember();
    opm2.setHostname(hostname);
    opm2.setPort(1);
    OrbPartitionMember opm3 = new OrbPartitionMember();
    opm3.setHostname(hostname);
    opm3.setPort(2);
    OrbPartitionMember opm4 = new OrbPartitionMember();
    opm4.setHostname(hostname);
    opm4.setPort(3);
    OrbPartitionMember opm5 = new OrbPartitionMember();
    opm5.setHostname(hostname);
    opm5.setPort(4);
    OrbPartitionMember opm6 = new OrbPartitionMember();
    opm6.setHostname(hostname);
    opm6.setPort(5);
    List<OrbPartitionMember> orbPartitionMembers = new ArrayList<OrbPartitionMember>();
    orbPartitionMembers.add(opm1);
    orbPartitionMembers.add(opm2);
    orbPartitionMembers.add(opm3);
    orbPartitionMembers.add(opm4);
    orbPartitionMembers.add(opm5);
    orbPartitionMembers.add(opm6);
    InputSplitAllocator isa = new InputSplitAllocator(orbConf, orbPartitionMembers);
    Map<OrbPartitionMember, List<RawSplit>> inputSplitAssignments = isa.assignInputSplits();
    long totalFileSize = 0;
    for (OrbPartitionMember orbPartitionMember : inputSplitAssignments.keySet()) {
        long rawSplitSize = 0;
        for (RawSplit rSplit : inputSplitAssignments.get(orbPartitionMember)) {
            rawSplitSize += rSplit.getDataLength();
        }
        totalFileSize += rawSplitSize;
        LOG.info(orbPartitionMember.getHostname() + ":" + orbPartitionMember.getPort() + " | RawSplits count: " + inputSplitAssignments.get(orbPartitionMember).size() + " | RawSplits size: " + rawSplitSize);
        assertTrue(inputSplitAssignments.get(orbPartitionMember).size() <= 5);
    }
    File testFile = new File("src/test/resources/InputSplitAllocatorDFSTestData.txt");
    assertTrue(totalFileSize == testFile.length());
}
Also used : Path(org.apache.hadoop.fs.Path) RawSplit(org.goldenorb.io.input.RawSplit) InputSplitAllocator(org.goldenorb.io.InputSplitAllocator) OrbConfiguration(org.goldenorb.conf.OrbConfiguration) ArrayList(java.util.ArrayList) OrbPartitionMember(org.goldenorb.jet.OrbPartitionMember) ArrayList(java.util.ArrayList) List(java.util.List) File(java.io.File) Test(org.junit.Test)

Example 5 with OrbConfiguration

use of org.goldenorb.conf.OrbConfiguration in project goldenorb by jzachr.

the class OrbPartitionManagerTest method setUpTest.

@BeforeClass
public static void setUpTest() throws IOException, InterruptedException, OrbZKFailure {
    orbConf = new OrbConfiguration(true);
    orbConf.setOrbZooKeeperQuorum("localhost:21810");
    ZK = ZookeeperUtils.connect(orbConf.getOrbZooKeeperQuorum());
}
Also used : OrbConfiguration(org.goldenorb.conf.OrbConfiguration) BeforeClass(org.junit.BeforeClass)

Aggregations

OrbConfiguration (org.goldenorb.conf.OrbConfiguration)26 Test (org.junit.Test)9 ArrayList (java.util.ArrayList)7 BeforeClass (org.junit.BeforeClass)6 InvalidJobConfException (org.apache.hadoop.mapred.InvalidJobConfException)4 OrbTracker (org.goldenorb.OrbTracker)4 IOException (java.io.IOException)3 Path (org.apache.hadoop.fs.Path)3 List (java.util.List)2 FloatWritable (org.apache.hadoop.io.FloatWritable)2 IntWritable (org.apache.hadoop.io.IntWritable)2 LongWritable (org.apache.hadoop.io.LongWritable)2 Text (org.apache.hadoop.io.Text)2 ZooKeeper (org.apache.zookeeper.ZooKeeper)2 InputSplitAllocator (org.goldenorb.io.InputSplitAllocator)2 RawSplit (org.goldenorb.io.input.RawSplit)2 OrbPartitionMember (org.goldenorb.jet.OrbPartitionMember)2 OrbZKFailure (org.goldenorb.zookeeper.OrbZKFailure)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1