Package org.apache.oozie

Examples of org.apache.oozie.CoordinatorJobInfo


        List<String> jobIdList = new ArrayList<String>();
        jobIdList.add(jobId);
        filter.put(OozieClient.FILTER_ID, jobIdList);

        CoordJobInfoGetJPAExecutor coordInfoGetCmd = new CoordJobInfoGetJPAExecutor(filter, 1, 20);
        CoordinatorJobInfo ret = jpaService.execute(coordInfoGetCmd);
        assertNotNull(ret);
        assertEquals(ret.getCoordJobs().size(), 1);
    }
View Full Code Here


        filter.put(OozieClient.FILTER_UNIT, unitList);
        frequencyList = new ArrayList<String>();
        frequencyList.add("1");
        filter.put(OozieClient.FILTER_FREQUENCY, frequencyList);
        CoordJobInfoGetJPAExecutor coordInfoGetCmd = new CoordJobInfoGetJPAExecutor(filter, 1, 20);
        CoordinatorJobInfo ret = jpaService.execute(coordInfoGetCmd);
        assertNotNull(ret);
        assertEquals(ret.getCoordJobs().size(), 0);
        frequencyList.remove(0);
        unitList.remove(0);

        // Test specifying frequency value as 3 days
        unitList.add("DAY");
        filter.put(OozieClient.FILTER_UNIT, unitList);
        frequencyList.add("3");
        filter.put(OozieClient.FILTER_FREQUENCY, frequencyList);
        coordInfoGetCmd = new CoordJobInfoGetJPAExecutor(filter, 1, 20);
        ret = jpaService.execute(coordInfoGetCmd);
        assertNotNull(ret);
        assertEquals(ret.getCoordJobs().size(), 0);
        frequencyList.remove(0);
        unitList.remove(0);

        // Test specifying frequency value as 1 day
        unitList.add("DAY");
        filter.put(OozieClient.FILTER_UNIT, unitList);
        frequencyList.add("1");
        filter.put(OozieClient.FILTER_FREQUENCY, frequencyList);
        coordInfoGetCmd = new CoordJobInfoGetJPAExecutor(filter, 1, 20);
        ret = jpaService.execute(coordInfoGetCmd);
        assertNotNull(ret);
        assertEquals(ret.getCoordJobs().size(), 3);
    }
View Full Code Here

            start = (start < 1) ? 1 : start;
            int len = (lenStr != null) ? Integer.parseInt(lenStr) : 50;
            len = (len < 1) ? 50 : len;
            CoordinatorEngine coordEngine = Services.get().get(CoordinatorEngineService.class).getCoordinatorEngine(
                    getUser(request), getAuthToken(request));
            CoordinatorJobInfo jobs = coordEngine.getCoordJobs(filter, start, len);
            List<CoordinatorJobBean> jsonJobs = jobs.getCoordJobs();
            json.put(JsonTags.COORDINATOR_JOBS, CoordinatorJobBean.toJSONArray(jsonJobs, timeZoneId));
            json.put(JsonTags.COORD_JOB_TOTAL, jobs.getTotal());
            json.put(JsonTags.COORD_JOB_OFFSET, jobs.getStart());
            json.put(JsonTags.COORD_JOB_LEN, jobs.getLen());

        }
        catch (CoordinatorEngineException ex) {
            throw new XServletException(HttpServletResponse.SC_BAD_REQUEST, ex);
        }
View Full Code Here

    }

    public CoordinatorJobInfo getCoordinatorInfo(final Map<String, List<String>> filter, final int start, final int len)
            throws StoreException {

        CoordinatorJobInfo coordJobInfo = doOperation("getCoordinatorJobInfo", new Callable<CoordinatorJobInfo>() {
            public CoordinatorJobInfo call() throws SQLException, StoreException {
                List<String> orArray = new ArrayList<String>();
                List<String> colArray = new ArrayList<String>();
                List<String> valArray = new ArrayList<String>();
                StringBuilder sb = new StringBuilder("");

                StoreStatusFilter.filter(filter, orArray, colArray, valArray, sb, StoreStatusFilter.coordSeletStr,
                                         StoreStatusFilter.coordCountStr);

                int realLen = 0;

                Query q = null;
                Query qTotal = null;
                if (orArray.size() == 0) {
                    q = entityManager.createNamedQuery("GET_COORD_JOBS_COLUMNS");
                    q.setFirstResult(start - 1);
                    q.setMaxResults(len);
                    qTotal = entityManager.createNamedQuery("GET_COORD_JOBS_COUNT");
                }
                else {
                    StringBuilder sbTotal = new StringBuilder(sb);
                    sb.append(" order by w.createdTimestamp desc ");
                    XLog.getLog(getClass()).debug("Created String is **** " + sb.toString());
                    q = entityManager.createQuery(sb.toString());
                    q.setFirstResult(start - 1);
                    q.setMaxResults(len);
                    qTotal = entityManager.createQuery(sbTotal.toString().replace(StoreStatusFilter.coordSeletStr,
                                                                                  StoreStatusFilter.coordCountStr));
                }

                for (int i = 0; i < orArray.size(); i++) {
                    q.setParameter(colArray.get(i), valArray.get(i));
                    qTotal.setParameter(colArray.get(i), valArray.get(i));
                }

                OpenJPAQuery kq = OpenJPAPersistence.cast(q);
                JDBCFetchPlan fetch = (JDBCFetchPlan) kq.getFetchPlan();
                fetch.setFetchBatchSize(20);
                fetch.setResultSetType(ResultSetType.SCROLL_INSENSITIVE);
                fetch.setFetchDirection(FetchDirection.FORWARD);
                fetch.setLRSSizeAlgorithm(LRSSizeAlgorithm.LAST);
                List<?> resultList = q.getResultList();
                List<Object[]> objectArrList = (List<Object[]>) resultList;
                List<CoordinatorJobBean> coordBeansList = new ArrayList<CoordinatorJobBean>();

                for (Object[] arr : objectArrList) {
                    CoordinatorJobBean ww = getBeanForCoordinatorJobFromArray(arr);
                    coordBeansList.add(ww);
                }

                realLen = ((Long) qTotal.getSingleResult()).intValue();

                return new CoordinatorJobInfo(coordBeansList, start, len, realLen);
            }
        });
        return coordJobInfo;
    }
View Full Code Here

        list.add("RUNNING");
        list.add("KILLED");
        filter.put(OozieClient.FILTER_STATUS, list);

        CoordJobInfoGetJPAExecutor coordInfoGetCmd = new CoordJobInfoGetJPAExecutor(filter, 1, 20);
        CoordinatorJobInfo ret = jpaService.execute(coordInfoGetCmd);
        assertNotNull(ret);
        assertEquals(ret.getCoordJobs().size(), 2);
    }
View Full Code Here

        List<String> list = new ArrayList<String>();
        list.add(getTestGroup());
        filter.put(OozieClient.FILTER_GROUP, list);

        CoordJobInfoGetJPAExecutor coordInfoGetCmd = new CoordJobInfoGetJPAExecutor(filter, 1, 20);
        CoordinatorJobInfo ret = jpaService.execute(coordInfoGetCmd);
        assertNotNull(ret);
        assertEquals(ret.getCoordJobs().size(), 2);
    }
View Full Code Here

        List<String> list = new ArrayList<String>();
        list.add("COORD-TEST");
        filter.put(OozieClient.FILTER_NAME, list);

        CoordJobInfoGetJPAExecutor coordInfoGetCmd = new CoordJobInfoGetJPAExecutor(filter, 1, 20);
        CoordinatorJobInfo ret = jpaService.execute(coordInfoGetCmd);
        assertNotNull(ret);
        assertEquals(ret.getCoordJobs().size(), 3);
    }
View Full Code Here

        List<String> list = new ArrayList<String>();
        list.add(getTestUser());
        filter.put(OozieClient.FILTER_USER, list);

        CoordJobInfoGetJPAExecutor coordInfoGetCmd = new CoordJobInfoGetJPAExecutor(filter, 1, 20);
        CoordinatorJobInfo ret = jpaService.execute(coordInfoGetCmd);
        assertNotNull(ret);
        assertEquals(ret.getCoordJobs().size(), 3);
    }
View Full Code Here

        List<String> list2 = new ArrayList<String>();
        list2.add("KILLED");
        filter.put(OozieClient.FILTER_STATUS, list2);

        CoordJobInfoGetJPAExecutor coordInfoGetCmd = new CoordJobInfoGetJPAExecutor(filter, 1, 20);
        CoordinatorJobInfo ret = jpaService.execute(coordInfoGetCmd);
        assertNotNull(ret);
        assertEquals(ret.getCoordJobs().size(), 2);
    }
View Full Code Here

        List<String> frequencyList = new ArrayList<String>();
        frequencyList.add("1");
        filter.put(OozieClient.FILTER_FREQUENCY, frequencyList);

        CoordJobInfoGetJPAExecutor coordInfoGetCmd = new CoordJobInfoGetJPAExecutor(filter, 1, 20);
        CoordinatorJobInfo ret = jpaService.execute(coordInfoGetCmd);
        assertNotNull(ret);
        assertEquals(ret.getCoordJobs().size(), 3);
    }
View Full Code Here

TOP

Related Classes of org.apache.oozie.CoordinatorJobInfo

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.