Package org.apache.ivory.entity.v0.process

Examples of org.apache.ivory.entity.v0.process.LateInput


      LateProcess lateProcess = new LateProcess();
      lateProcess.setDelay(new Frequency(RuntimeProperties.get()
          .getProperty("feed.late.frequency", "hours(3)")));
      lateProcess.setPolicy(PolicyType.fromValue(RuntimeProperties.get()
          .getProperty("feed.late.policy", "exp-backoff")));
      LateInput lateInput = new LateInput();
      lateInput.setInput(entity.getName());
      //TODO - Assuming the late workflow is not used
      lateInput.setWorkflowPath("ignore.xml");
      lateProcess.getLateInputs().add(lateInput);
      return lateProcess;
    case PROCESS:
      Process process = (Process) entity;
      return process.getLateProcess();
View Full Code Here


    }

    private Feed addOutput(Process process, String feed, Cluster cluster) {
        if (process.getOutputs() == null) process.setOutputs(new Outputs());
        Outputs Outputs = process.getOutputs();
        Output Output = new Output();
        Output.setFeed(feed);
        Outputs.getOutputs().add(Output);
        Feed f1 = new Feed();
        f1.setName(feed);
        Clusters clusters = new Clusters();
        f1.setClusters(clusters);
View Full Code Here

        input.setFeed(feed.getName());
        inputs.getInputs().add(input);
    }

    private Feed addOutput(Process process, String feed, Cluster cluster) {
        if (process.getOutputs() == null) process.setOutputs(new Outputs());
        Outputs Outputs = process.getOutputs();
        Output Output = new Output();
        Output.setFeed(feed);
        Outputs.getOutputs().add(Output);
        Feed f1 = new Feed();
        f1.setName(feed);
        Clusters clusters = new Clusters();
        f1.setClusters(clusters);
        org.apache.ivory.entity.v0.feed.Cluster feedCluster =
View Full Code Here

            store(EntityType.valueOf(type.toUpperCase()), xml);
        }

        entity = args[2];
        Entity obj = EntityUtil.getEntity(type, entity);
        Process newEntity = (Process)obj.clone();
        newEntity.setFrequency(Frequency.fromString("minutes(5)"));
        System.out.println("##############OLD ENTITY " + EntityUtil.md5(obj));
        System.out.println("##############NEW ENTITY " + EntityUtil.md5(newEntity));


//        OozieWorkflowEngine engine = new OozieWorkflowEngine();
//        Date start = formatter.parse("2010-01-02 01:05 UTC");
//        Date end = formatter.parse("2010-01-02 01:21 UTC");
//        InstancesResult status = engine.suspendInstances(obj, start, end, new Properties());
//        System.out.println(Arrays.toString(status.getInstances()));
//        AbstractInstanceManager manager = new InstanceManager();
//        InstancesResult result = manager.suspendInstance(new NullServletRequest(), type, entity,
//                "2010-01-02T01:05Z", "2010-01-02T01:21Z", "*");

        DeploymentProperties.get().setProperty("deploy.mode", "standalone");
        StartupProperties.get().setProperty("current.colo", "ua1");
        OozieWorkflowEngine engine = new OozieWorkflowEngine();
        ConfigurationStore.get().initiateUpdate(newEntity);
        engine.update(obj, newEntity, newEntity.getClusters().getClusters().get(0).getName());
        engine.delete(newEntity);
        System.exit(0);
    }
View Full Code Here

                feed.setName(name);
                store.publish(type, feed);
                break;

            case PROCESS:
                Process process = (Process) unmarshaller.unmarshal(this.getClass().getResource(PROCESS_XML));
                process.setName(name);
                FileSystem fs =dfsCluster.getFileSystem();
                fs.mkdirs(new Path(process.getWorkflow().getPath()));
                if (!fs.exists(new Path(process.getWorkflow()+"/lib"))) {
                  fs.mkdirs(new Path(process.getWorkflow()+"/lib"));
                }
                store.publish(type, process);
                break;
        }
    }
View Full Code Here

    private EntityGraph graph = EntityGraph.get();

    @Test
    public void testOnAdd() throws Exception {

        Process process = new Process();
        process.setName("p1");
        Cluster cluster = new Cluster();
        cluster.setName("c1");
        cluster.setColo("1");
        Feed f1 = addInput(process, "f1", cluster);
        Feed f2 = addInput(process, "f2", cluster);
        Feed f3 = addOutput(process, "f3", cluster);
        Feed f4 = addOutput(process, "f4", cluster);
        org.apache.ivory.entity.v0.process.Cluster processCluster = new org.apache.ivory.entity.v0.process.Cluster();
        processCluster.setName("c1");
        process.setClusters(new org.apache.ivory.entity.v0.process.Clusters());
        process.getClusters().getClusters().add(processCluster);

        store.publish(EntityType.CLUSTER, cluster);
        store.publish(EntityType.FEED, f1);
        store.publish(EntityType.FEED, f2);
        store.publish(EntityType.FEED, f3);
View Full Code Here

        storeEntity(EntityType.FEED, "imp-click-join1");
        storeEntity(EntityType.FEED, "imp-click-join2");
        Feed feed = parser.parseAndValidate(this.getClass()
                .getResourceAsStream(FEED_XML));
        ConfigurationStore.get().publish(EntityType.FEED, feed);
        Process process = processParser.parseAndValidate(this.getClass()
                .getResourceAsStream(PROCESS1_XML));
        ConfigurationStore.get().publish(EntityType.PROCESS, process);
        Process p1 = (Process) process.clone();
        p1.setName("sample2");
        ConfigurationStore.get().publish(EntityType.PROCESS, p1);

        try {
            //Try parsing the same feed xml
            parser.parseAndValidate(this.getClass()
View Full Code Here

        return f1;
    }

    @Test
    public void testOnRemove() throws Exception {
        Process process = new Process();
        process.setName("rp1");
        Cluster cluster = new Cluster();
        cluster.setName("rc1");
        cluster.setColo("2");
        org.apache.ivory.entity.v0.process.Cluster processCluster = new org.apache.ivory.entity.v0.process.Cluster();
        processCluster.setName("rc1");
        process.setClusters(new org.apache.ivory.entity.v0.process.Clusters());
        process.getClusters().getClusters().add(processCluster);

        store.publish(EntityType.CLUSTER, cluster);
        store.publish(EntityType.PROCESS, process);

        Set<Entity> entities = graph.getDependents(process);
        Assert.assertEquals(entities.size(), 1);
        Assert.assertTrue(entities.contains(cluster));

        entities = graph.getDependents(cluster);
        Assert.assertEquals(entities.size(), 1);
        Assert.assertTrue(entities.contains(process));

        store.remove(EntityType.PROCESS, process.getName());
        entities = graph.getDependents(cluster);
        Assert.assertTrue(entities == null);

        entities = graph.getDependents(process);
        Assert.assertTrue(entities == null);
View Full Code Here

    }

    @Test
    public void testOnRemove2() throws Exception {

        Process p1 = new Process();
        p1.setName("ap1");
        Process p2 = new Process();
        p2.setName("ap2");
        Cluster cluster = new Cluster();
        cluster.setName("ac1");
        cluster.setColo("3");
        Feed f1 = addInput(p1, "af1", cluster);
        Feed f3 = addOutput(p1, "af3", cluster);
        Feed f2 = addOutput(p2, "af2", cluster);
        attachInput(p2, f3);
        org.apache.ivory.entity.v0.process.Cluster processCluster = new org.apache.ivory.entity.v0.process.Cluster();
        processCluster.setName("ac1");
        p1.setClusters(new org.apache.ivory.entity.v0.process.Clusters());
        p1.getClusters().getClusters().add(processCluster);
        processCluster = new org.apache.ivory.entity.v0.process.Cluster();
        processCluster.setName("ac1");
        p2.setClusters(new org.apache.ivory.entity.v0.process.Clusters());
        p2.getClusters().getClusters().add(processCluster);

        store.publish(EntityType.CLUSTER, cluster);
        store.publish(EntityType.FEED, f1);
        store.publish(EntityType.FEED, f2);
        store.publish(EntityType.FEED, f3);
        store.publish(EntityType.PROCESS, p1);
        store.publish(EntityType.PROCESS, p2);

        Set<Entity> entities = graph.getDependents(p1);
        Assert.assertEquals(entities.size(), 3);
        Assert.assertTrue(entities.contains(cluster));
        Assert.assertTrue(entities.contains(f1));
        Assert.assertTrue(entities.contains(f3));

        entities = graph.getDependents(p2);
        Assert.assertEquals(entities.size(), 3);
        Assert.assertTrue(entities.contains(cluster));
        Assert.assertTrue(entities.contains(f2));
        Assert.assertTrue(entities.contains(f3));

        entities = graph.getDependents(f1);
        Assert.assertEquals(entities.size(), 2);
        Assert.assertTrue(entities.contains(p1));
        Assert.assertTrue(entities.contains(cluster));

        entities = graph.getDependents(f2);
        Assert.assertEquals(entities.size(), 2);
        Assert.assertTrue(entities.contains(p2));
        Assert.assertTrue(entities.contains(cluster));

        entities = graph.getDependents(f3);
        Assert.assertEquals(entities.size(), 3);
        Assert.assertTrue(entities.contains(p2));
        Assert.assertTrue(entities.contains(p1));
        Assert.assertTrue(entities.contains(cluster));

        entities = graph.getDependents(cluster);
        Assert.assertEquals(entities.size(), 5);
        Assert.assertTrue(entities.contains(p1));
        Assert.assertTrue(entities.contains(p2));
        Assert.assertTrue(entities.contains(f1));
        Assert.assertTrue(entities.contains(f2));
        Assert.assertTrue(entities.contains(f3));

        store.remove(EntityType.PROCESS, p2.getName());
        store.remove(EntityType.FEED, f2.getName());

        entities = graph.getDependents(p1);
        Assert.assertEquals(entities.size(), 3);
        Assert.assertTrue(entities.contains(cluster));
View Full Code Here

    }

    @Test
    public void testParse() throws IvoryException, JAXBException {

        Process process = parser.parseAndValidate(getClass().getResourceAsStream(PROCESS_XML));
       
        Assert.assertNotNull(process);
        Assert.assertEquals(process.getName(), "sample");

        Assert.assertEquals(process.getParallel(), 1);
        Assert.assertEquals(process.getOrder().name(), "LIFO");
        Assert.assertEquals(process.getFrequency().toString(), "hours(1)");
        Assert.assertEquals(process.getEntityType(), EntityType.PROCESS);

        Assert.assertEquals(process.getInputs().getInputs().get(0).getName(), "impression");
        Assert.assertEquals(process.getInputs().getInputs().get(0).getFeed(), "impressionFeed");
        Assert.assertEquals(process.getInputs().getInputs().get(0).getStart(), "today(0,0)");
        Assert.assertEquals(process.getInputs().getInputs().get(0).getEnd(), "today(2,0)");
        Assert.assertEquals(process.getInputs().getInputs().get(0).getPartition(), "*/US");
        Assert.assertEquals(process.getInputs().getInputs().get(0).isOptional(), false);

        Assert.assertEquals(process.getOutputs().getOutputs().get(0).getName(), "impOutput");
        Assert.assertEquals(process.getOutputs().getOutputs().get(0).getFeed(), "imp-click-join1");
        Assert.assertEquals(process.getOutputs().getOutputs().get(0).getInstance(), "today(0,0)");

        Assert.assertEquals(process.getProperties().getProperties().get(0).getName(), "name1");
        Assert.assertEquals(process.getProperties().getProperties().get(0).getValue(), "value1");

        Cluster processCluster = process.getClusters().getClusters().get(0);
        Assert.assertEquals(SchemaHelper.formatDateUTC(processCluster.getValidity().getStart()), "2011-11-02T00:00Z");
        Assert.assertEquals(SchemaHelper.formatDateUTC(processCluster.getValidity().getEnd()), "2011-12-30T00:00Z");
        Assert.assertEquals(process.getTimezone().getID(), "UTC");

        Assert.assertEquals(process.getWorkflow().getEngine().name().toLowerCase(), "oozie");
        Assert.assertEquals(process.getWorkflow().getPath(), "/path/to/workflow");

        StringWriter stringWriter = new StringWriter();
        Marshaller marshaller = EntityType.PROCESS.getMarshaller();
        marshaller.marshal(process, stringWriter);
        System.out.println(stringWriter.toString());
View Full Code Here

TOP

Related Classes of org.apache.ivory.entity.v0.process.LateInput

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.