Package org.apache.oozie.client

Examples of org.apache.oozie.client.ProxyOozieClient$OozieConfiguration


        TestContext context = newContext();
        context.scheduleProcess();
        OozieTestUtils.waitForBundleStart(context, Job.Status.RUNNING);
        List<BundleJob> bundles = OozieTestUtils.getBundles(context);
        Assert.assertEquals(bundles.size(), 1);
        ProxyOozieClient ozClient = OozieTestUtils.getOozieClient(context.getCluster().getCluster());
        String coordId = ozClient.getBundleJobInfo(bundles.get(0).getId()).getCoordinators().get(0).getId();

        Process process = (Process) getDefinition(context, EntityType.PROCESS, context.processName);

        String feed3 = "f3" + System.currentTimeMillis();
        Map<String, String> overlay = new HashMap<String, String>();
        overlay.put("inputFeedName", feed3);
        overlay.put("cluster", context.clusterName);
        ClientResponse response = context.submitToFalcon(TestContext.FEED_TEMPLATE1, overlay, EntityType.FEED);
        context.assertSuccessful(response);

        Input input = new Input();
        input.setFeed(feed3);
        input.setName("inputData2");
        input.setStart("today(20,0)");
        input.setEnd("today(20,20)");
        process.getInputs().getInputs().add(input);

        updateEndtime(process);
        Date endTime = getEndTime();
        update(context, process, endTime);

        //Assert that update creates new bundle and old coord is running
        bundles = OozieTestUtils.getBundles(context);
        Assert.assertEquals(bundles.size(), 2);
        CoordinatorJob coord = ozClient.getCoordJobInfo(coordId);
        Assert.assertEquals(coord.getStatus(), Status.RUNNING);
        Assert.assertEquals(coord.getEndTime(), endTime);
    }
View Full Code Here


        List<BundleJob> bundles = new ArrayList<BundleJob>();
        if (context.getClusterName() == null) {
            return bundles;
        }

        ProxyOozieClient ozClient = OozieClientFactory.get(context.getCluster().getCluster());
        return ozClient.getBundleJobsInfo("name=FALCON_PROCESS_" + context.getProcessName(), 0, 10);
    }
View Full Code Here

    public static boolean killOozieJobs(TestContext context) throws Exception {
        if (context.getCluster() == null) {
            return true;
        }

        ProxyOozieClient ozClient = getOozieClient(context);
        List<BundleJob> bundles = getBundles(context);
        if (bundles != null) {
            for (BundleJob bundle : bundles) {
                ozClient.kill(bundle.getId());
            }
        }

        return false;
    }
View Full Code Here

        throw new Exception("Workflow for " + entityName + " hasn't started in oozie");
    }

    private static List<WorkflowJob> getRunningJobs(TestContext context, String entityName) throws Exception {
        ProxyOozieClient ozClient = getOozieClient(context);
        return ozClient.getJobsInfo(
                ProxyOozieClient.FILTER_STATUS + '=' + Job.Status.RUNNING + ';'
                        + ProxyOozieClient.FILTER_NAME + '=' + "FALCON_PROCESS_DEFAULT_" + entityName);
    }
View Full Code Here

                ProxyOozieClient.FILTER_STATUS + '=' + Job.Status.RUNNING + ';'
                        + ProxyOozieClient.FILTER_NAME + '=' + "FALCON_PROCESS_DEFAULT_" + entityName);
    }

    public static void waitForBundleStart(TestContext context, Job.Status... status) throws Exception {
        ProxyOozieClient ozClient = getOozieClient(context);
        List<BundleJob> bundles = getBundles(context);
        if (bundles.isEmpty()) {
            return;
        }

        Set<Job.Status> statuses = new HashSet<Job.Status>(Arrays.asList(status));
        String bundleId = bundles.get(0).getId();
        for (int i = 0; i < 15; i++) {
            Thread.sleep(i * 1000);
            BundleJob bundle = ozClient.getBundleJobInfo(bundleId);
            if (statuses.contains(bundle.getStatus())) {
                if (statuses.contains(Job.Status.FAILED) || statuses.contains(Job.Status.KILLED)) {
                    return;
                }

View Full Code Here

        }
        throw new Exception("Bundle " + bundleId + " is not " + statuses + " in oozie");
    }

    public static WorkflowJob getWorkflowJob(Cluster cluster, String filter) throws Exception {
        ProxyOozieClient ozClient = getOozieClient(cluster);

        List<WorkflowJob> jobs;
        while (true) {
            jobs = ozClient.getJobsInfo(filter);
            System.out.println("jobs = " + jobs);
            if (jobs.size() > 0) {
                break;
            } else {
                Thread.sleep(1000);
            }
        }

        WorkflowJob jobInfo = jobs.get(0);
        while (true) {
            if (!(jobInfo.getStatus() == WorkflowJob.Status.RUNNING
                    || jobInfo.getStatus() == WorkflowJob.Status.PREP)) {
                break;
            } else {
                Thread.sleep(1000);
                jobInfo = ozClient.getJobInfo(jobInfo.getId());
                System.out.println("jobInfo = " + jobInfo);
            }
        }

        return jobInfo;
View Full Code Here

        throws FalconException {

        assert cluster != null : "Cluster cant be null";
        String oozieUrl = ClusterHelper.getOozieUrl(cluster);
        if (!CACHE.containsKey(oozieUrl)) {
            ProxyOozieClient ref = getClientRef(oozieUrl);
            LOG.info("Caching Oozie client object for " + oozieUrl);
            CACHE.putIfAbsent(oozieUrl, ref);
        }

        return CACHE.get(oozieUrl);
View Full Code Here

        throws FalconException {

        if (LOCAL_OOZIE.equals(oozieUrl)) {
            return getLocalOozieClient();
        } else {
            return new ProxyOozieClient(oozieUrl);
        }
    }
View Full Code Here

    }

    private void waitForWorkflow(String instance, WorkflowJob.Status status) throws Exception {
        TestContext context = new TestContext();
        ExternalId extId = new ExternalId(context.processName, Tag.DEFAULT, EntityUtil.parseDateUTC(instance));
        ProxyOozieClient ozClient = OozieClientFactory.get(
                (Cluster) ConfigurationStore.get().get(EntityType.CLUSTER, context.clusterName));
        String jobId = ozClient.getJobId(extId.getId());
        WorkflowJob jobInfo = null;
        for (int i = 0; i < 15; i++) {
            jobInfo = ozClient.getJobInfo(jobId);
            if (jobInfo.getStatus() == status) {
                break;
            }
            System.out.println("Waiting for workflow job " + jobId + " status " + status);
            Thread.sleep((i + 1) * 1000);
 
View Full Code Here

TOP

Related Classes of org.apache.oozie.client.ProxyOozieClient$OozieConfiguration

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.