Package org.apache.falcon.entity.v0.process

Examples of org.apache.falcon.entity.v0.process.Cluster


        Entity entity = (Entity) unmarshaller
                .unmarshal(OozieFeedMapperTest.class.getResource(template));
        store.publish(type, entity);

        if (type == EntityType.CLUSTER) {
            Cluster cluster = (Cluster) entity;
            ClusterHelper.getInterface(cluster, Interfacetype.WRITE).setEndpoint(writeEndpoint);
            FileSystem fs = new Path(writeEndpoint).getFileSystem(new Configuration());
            fs.create(new Path(ClusterHelper.getLocation(cluster, "working"), "libext/FEED/retention/ext.jar")).close();
            fs.create(
                    new Path(ClusterHelper.getLocation(cluster, "working"), "libext/FEED/replication/ext.jar")).close();
View Full Code Here


    public void onAdd(Entity entity, boolean ignoreFailure) {
        if (entity.getEntityType() != EntityType.CLUSTER) {
            return;
        }

        Cluster cluster = (Cluster) entity;
        COLO_CLUSTER_MAP.putIfAbsent(cluster.getColo(), new HashSet<String>());
        COLO_CLUSTER_MAP.get(cluster.getColo()).add(cluster.getName());
    }
View Full Code Here

    public void onRemove(Entity entity) {
        if (entity.getEntityType() != EntityType.CLUSTER) {
            return;
        }

        Cluster cluster = (Cluster) entity;
        COLO_CLUSTER_MAP.get(cluster.getColo()).remove(cluster.getName());
        if (COLO_CLUSTER_MAP.get(cluster.getColo()).isEmpty()) {
            COLO_CLUSTER_MAP.remove(cluster.getColo());
        }
    }
View Full Code Here

*/
@Test
public class ColoClusterRelationTest extends AbstractTestBase {

    private Cluster newCluster(String name, String colo) {
        Cluster cluster = new Cluster();
        cluster.setName(name);
        cluster.setColo(colo);
        return cluster;
    }
View Full Code Here

        return cluster;
    }

    @Test
    public void testMapping() throws Exception {
        Cluster cluster1 = newCluster("cluster1", "colo1");
        Cluster cluster2 = newCluster("cluster2", "colo1");
        Cluster cluster3 = newCluster("cluster3", "colo2");
        getStore().publish(EntityType.CLUSTER, cluster1);
        getStore().publish(EntityType.CLUSTER, cluster2);
        getStore().publish(EntityType.CLUSTER, cluster3);

        ColoClusterRelation relation = ColoClusterRelation.get();
        Set<String> clusters = relation.getClusters("colo1");
        Assert.assertNotNull(clusters);
        Assert.assertEquals(2, clusters.size());
        Assert.assertTrue(clusters.contains(cluster1.getName()));
        Assert.assertTrue(clusters.contains(cluster2.getName()));

        clusters = relation.getClusters("colo2");
        Assert.assertNotNull(clusters);
        Assert.assertEquals(1, clusters.size());
        Assert.assertTrue(clusters.contains(cluster3.getName()));

        getStore().remove(EntityType.CLUSTER, cluster1.getName());
        clusters = relation.getClusters("colo1");
        Assert.assertNotNull(clusters);
        Assert.assertEquals(1, clusters.size());
View Full Code Here

        Map<String, String> overlay = sourceContext.getUniqueOverlay();
        String sourceFilePath = sourceContext.overlayParametersOverTemplate("/table/primary-cluster.xml", overlay);
        sourceContext.setCluster(sourceFilePath);

        final Cluster sourceCluster = sourceContext.getCluster().getCluster();
        String sourceStorageUrl = ClusterHelper.getStorageUrl(sourceCluster);

        // copyTestDataToHDFS
        final String sourcePath = sourceStorageUrl + SOURCE_LOCATION + PARTITION_VALUE;
        FSUtils.copyResourceToHDFS("/apps/data/data.txt", "data.txt", sourcePath);

        String targetFilePath = targetContext.overlayParametersOverTemplate("/table/bcp-cluster.xml", overlay);
        targetContext.setCluster(targetFilePath);

        final Cluster targetCluster = targetContext.getCluster().getCluster();
        copyLibsToHDFS(targetCluster);

        String file = targetAlphaContext.overlayParametersOverTemplate("/table/target-cluster-alpha.xml", overlay);
        targetAlphaContext.setCluster(file);
        copyLibsToHDFS(targetAlphaContext.getCluster().getCluster());
View Full Code Here

    }

    @Test (enabled = false)
    public void testFSReplicationComplex() throws Exception {
        // copyTestDataToHDFS
        Cluster sourceCluster = sourceContext.getCluster().getCluster();
        FileSystem sourceFS = FileSystem.get(ClusterHelper.getConfiguration(sourceCluster));
        String sourceStorageUrl = ClusterHelper.getStorageUrl(sourceCluster);
        final String partitionValue = "2012-10-01-12";
        String sourceLocation = sourceStorageUrl + SOURCE_LOCATION + partitionValue + "/" + sourceCluster.getColo();
        FSUtils.copyResourceToHDFS("/apps/data/data.txt", "data.txt", sourceLocation);
        Path sourcePath = new Path(sourceLocation);
        Assert.assertTrue(sourceFS.exists(sourcePath));

        final Map<String, String> overlay = sourceContext.getUniqueOverlay();
View Full Code Here

        org.apache.falcon.entity.v0.process.Cluster processCluster = ProcessHelper.getCluster(process, clusterName);
        if (!startDate.before(processCluster.getValidity().getEnd())) {// start time >= end time
            return null;
        }

        Cluster cluster = CONFIG_STORE.get(EntityType.CLUSTER, processCluster.getName());
        Path bundlePath = new Path(ClusterHelper.getLocation(cluster, "staging"), EntityUtil.getStagingPath(process));
        Process processClone = (Process) process.copy();
        EntityUtil.setStartDate(processClone, clusterName, startDate);

        OozieProcessMapper mapper = new OozieProcessMapper(processClone);
View Full Code Here

        Unmarshaller unmarshaller = type.getUnmarshaller();
        ConfigurationStore store = ConfigurationStore.get();
        store.remove(type, name);
        switch (type) {
        case CLUSTER:
            Cluster cluster = (Cluster) unmarshaller.unmarshal(this.getClass().getResource(resource));
            cluster.setName(name);
            store.publish(type, cluster);
            break;

        case FEED:
            Feed feed = (Feed) unmarshaller.unmarshal(this.getClass().getResource(resource));
View Full Code Here

        dfsCluster = EmbeddedCluster.newCluster("testCluster");
        Configuration conf = dfsCluster.getConf();
        String hdfsUrl = conf.get("fs.default.name");

        Cluster cluster = (Cluster) EntityType.CLUSTER.getUnmarshaller()
                .unmarshal(this.getClass().getResource(CLUSTER_XML));
        ClusterHelper.getInterface(cluster, Interfacetype.WRITE).setEndpoint(hdfsUrl);

        STORE.publish(EntityType.CLUSTER, cluster);
View Full Code Here

TOP

Related Classes of org.apache.falcon.entity.v0.process.Cluster

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.