Package org.apache.falcon.oozie.coordinator

Examples of org.apache.falcon.oozie.coordinator.WORKFLOW


        props.put("userWorkflowEngine", processWorkflow.getEngine().value());

        // create parent wf
        createWorkflow(cluster, process, processWorkflow, coordName, coordPath);

        WORKFLOW wf = new WORKFLOW();
        wf.setAppPath(getStoragePath(coordPath.toString()));
        wf.setConfiguration(getCoordConfig(props));

        // set coord action to parent wf
        org.apache.falcon.oozie.coordinator.ACTION action = new org.apache.falcon.oozie.coordinator.ACTION();
        action.setWorkflow(wf);
        coord.setAction(action);
View Full Code Here


        private ACTION getRetentionWorkflowAction(Cluster cluster, Path wfPath, String wfName)
            throws FalconException {
            Feed feed = getEntity();
            ACTION retentionAction = new ACTION();
            WORKFLOW retentionWorkflow = new WORKFLOW();
            createRetentionWorkflow(cluster, wfPath, wfName);
            retentionWorkflow.setAppPath(getStoragePath(wfPath.toString()));

            Map<String, String> props = createCoordDefaultConfiguration(cluster, wfPath, wfName);
            props.put("timeZone", feed.getTimezone().getID());
            props.put("frequency", feed.getFrequency().getTimeUnit().name());

            final Storage storage = FeedHelper.createStorage(cluster, feed);
            props.put("falconFeedStorageType", storage.getType().name());

            String feedDataPath = storage.getUriTemplate();
            props.put("feedDataPath",
                    feedDataPath.replaceAll(Storage.DOLLAR_EXPR_START_REGEX, Storage.QUESTION_EXPR_START_REGEX));

            org.apache.falcon.entity.v0.feed.Cluster feedCluster =
                    FeedHelper.getCluster(feed, cluster.getName());
            props.put("limit", feedCluster.getRetention().getLimit().toString());

            props.put(ARG.operation.getPropName(), EntityOps.DELETE.name());
            props.put(ARG.feedNames.getPropName(), feed.getName());
            props.put(ARG.feedInstancePaths.getPropName(), "IGNORE");

            retentionWorkflow.setConfiguration(getCoordConfig(props));
            retentionAction.setWorkflow(retentionWorkflow);

            return retentionAction;
        }
View Full Code Here

        private ACTION getReplicationWorkflowAction(Cluster srcCluster, Cluster trgCluster, Path wfPath,
                                                    String wfName, Storage sourceStorage,
                                                    Storage targetStorage) throws FalconException {
            ACTION replicationAction = new ACTION();
            WORKFLOW replicationWF = new WORKFLOW();
            try {
                replicationWF.setAppPath(getStoragePath(wfPath.toString()));
                Feed feed = getEntity();

                Map<String, String> props = createCoordDefaultConfiguration(trgCluster, wfPath, wfName);
                props.put("srcClusterName", srcCluster.getName());
                props.put("srcClusterColo", srcCluster.getColo());

                // the storage type is uniform across source and target feeds for replication
                props.put("falconFeedStorageType", sourceStorage.getType().name());

                String instancePaths = null;
                if (sourceStorage.getType() == Storage.TYPE.FILESYSTEM) {
                    String pathsWithPartitions = getPathsWithPartitions(srcCluster, trgCluster, feed);
                    instancePaths = pathsWithPartitions;

                    propagateFileSystemCopyProperties(pathsWithPartitions, props);
                } else if (sourceStorage.getType() == Storage.TYPE.TABLE) {
                    instancePaths = "${coord:dataIn('input')}";

                    final CatalogStorage sourceTableStorage = (CatalogStorage) sourceStorage;
                    propagateTableStorageProperties(srcCluster, sourceTableStorage, props, "falconSource");
                    final CatalogStorage targetTableStorage = (CatalogStorage) targetStorage;
                    propagateTableStorageProperties(trgCluster, targetTableStorage, props, "falconTarget");
                    propagateTableCopyProperties(srcCluster, sourceTableStorage,
                            trgCluster, targetTableStorage, props);
                    setupHiveConfiguration(trgCluster, sourceTableStorage, targetTableStorage, wfPath);
                }

                propagateLateDataProperties(feed, instancePaths, sourceStorage.getType().name(), props);

                replicationWF.setConfiguration(getCoordConfig(props));
                replicationAction.setWorkflow(replicationWF);

            } catch (Exception e) {
                throw new FalconException("Unable to create replication workflow", e);
            }
View Full Code Here

        propagateUserWorkflowProperties(processWorkflow, props, entity.getName());

        // create parent wf
        createWorkflow(cluster, entity, processWorkflow, coordName, coordPath);

        WORKFLOW wf = new WORKFLOW();
        wf.setAppPath(getStoragePath(coordPath.toString()));
        wf.setConfiguration(getCoordConfig(props));

        // set coord action to parent wf
        org.apache.falcon.oozie.coordinator.ACTION action = new org.apache.falcon.oozie.coordinator.ACTION();
        action.setWorkflow(wf);
        coord.setAction(action);
View Full Code Here

        }

        private ACTION getRetentionWorkflowAction(Cluster cluster, Path wfPath, String wfName)
            throws FalconException {
            ACTION retentionAction = new ACTION();
            WORKFLOW retentionWorkflow = new WORKFLOW();
            createRetentionWorkflow(cluster, wfPath, wfName);
            retentionWorkflow.setAppPath(getStoragePath(wfPath.toString()));

            Map<String, String> props = createCoordDefaultConfiguration(cluster, wfPath, wfName);
            props.put("timeZone", entity.getTimezone().getID());
            props.put("frequency", entity.getFrequency().getTimeUnit().name());

            final Storage storage = FeedHelper.createStorage(cluster, entity);
            props.put("falconFeedStorageType", storage.getType().name());

            String feedDataPath = storage.getUriTemplate();
            props.put("feedDataPath",
                feedDataPath.replaceAll(Storage.DOLLAR_EXPR_START_REGEX, Storage.QUESTION_EXPR_START_REGEX));

            org.apache.falcon.entity.v0.feed.Cluster feedCluster = FeedHelper.getCluster(entity, cluster.getName());
            props.put("limit", feedCluster.getRetention().getLimit().toString());

            props.put(ARG.operation.getPropName(), EntityOps.DELETE.name());
            props.put(ARG.feedNames.getPropName(), entity.getName());
            props.put(ARG.feedInstancePaths.getPropName(), IGNORE);

            props.put("falconInputFeeds", entity.getName());
            props.put("falconInPaths", IGNORE);

            propagateUserWorkflowProperties(props, "eviction");

            retentionWorkflow.setConfiguration(getCoordConfig(props));
            retentionAction.setWorkflow(retentionWorkflow);
            return retentionAction;
        }
View Full Code Here

        private ACTION getReplicationWorkflowAction(Cluster srcCluster, Cluster trgCluster, Path wfPath,
                                                    String wfName, Storage sourceStorage,
                                                    Storage targetStorage) throws FalconException {
            ACTION replicationAction = new ACTION();
            WORKFLOW replicationWF = new WORKFLOW();

            replicationWF.setAppPath(getStoragePath(wfPath.toString()));
            Map<String, String> props = createCoordDefaultConfiguration(trgCluster, wfPath, wfName);
            props.put("srcClusterName", srcCluster.getName());
            props.put("srcClusterColo", srcCluster.getColo());
            if (props.get(MR_MAX_MAPS) == null) { // set default if user has not overridden
                props.put(MR_MAX_MAPS, getDefaultMaxMaps());
            }
            if (props.get(MR_MAP_BANDWIDTH) == null) { // set default if user has not overridden
                props.put(MR_MAP_BANDWIDTH, getDefaultMapBandwidth());
            }

            // the storage type is uniform across source and target feeds for replication
            props.put("falconFeedStorageType", sourceStorage.getType().name());

            String instancePaths = null;
            if (sourceStorage.getType() == Storage.TYPE.FILESYSTEM) {
                String pathsWithPartitions = getPathsWithPartitions(srcCluster, trgCluster, entity);
                instancePaths = pathsWithPartitions;

                propagateFileSystemCopyProperties(pathsWithPartitions, props);
            } else if (sourceStorage.getType() == Storage.TYPE.TABLE) {
                instancePaths = "${coord:dataIn('input')}";

                final CatalogStorage sourceTableStorage = (CatalogStorage) sourceStorage;
                propagateTableStorageProperties(srcCluster, sourceTableStorage, props, "falconSource");
                final CatalogStorage targetTableStorage = (CatalogStorage) targetStorage;
                propagateTableStorageProperties(trgCluster, targetTableStorage, props, "falconTarget");
                propagateTableCopyProperties(srcCluster, sourceTableStorage,
                    trgCluster, targetTableStorage, props);
                setupHiveConfiguration(srcCluster, trgCluster, wfPath);
            }

            propagateLateDataProperties(entity, instancePaths, sourceStorage.getType().name(), props);
            propagateUserWorkflowProperties(props, "replication");

            replicationWF.setConfiguration(getCoordConfig(props));
            replicationAction.setWorkflow(replicationWF);

            return replicationAction;
        }
View Full Code Here

        props.put("userWorkflowEngine", processWorkflow.getEngine().value());

        // create parent wf
        createWorkflow(cluster, process, processWorkflow, coordName, coordPath);

        WORKFLOW wf = new WORKFLOW();
        wf.setAppPath(getStoragePath(coordPath.toString()));
        wf.setConfiguration(getCoordConfig(props));

        // set coord action to parent wf
        org.apache.falcon.oozie.coordinator.ACTION action = new org.apache.falcon.oozie.coordinator.ACTION();
        action.setWorkflow(wf);
        coord.setAction(action);
View Full Code Here

    }

    private ACTION getRetentionWorkflowAction(Cluster cluster, Path wfPath, String wfName) throws FalconException {
        Feed feed = getEntity();
        ACTION retentionAction = new ACTION();
        WORKFLOW retentionWorkflow = new WORKFLOW();
        try {
            //
            WORKFLOWAPP retWfApp = createRetentionWorkflow(cluster);
            retWfApp.setName(wfName);
            marshal(cluster, retWfApp, wfPath);
            retentionWorkflow.setAppPath(getStoragePath(wfPath.toString()));

            Map<String, String> props = createCoordDefaultConfiguration(cluster, wfPath, wfName);

            org.apache.falcon.entity.v0.feed.Cluster feedCluster = FeedHelper.getCluster(feed, cluster.getName());
            String feedPathMask = getLocationURI(cluster, feed, LocationType.DATA);
            String metaPathMask = getLocationURI(cluster, feed, LocationType.META);
            String statsPathMask = getLocationURI(cluster, feed, LocationType.STATS);
            String tmpPathMask = getLocationURI(cluster, feed, LocationType.TMP);

            StringBuilder feedBasePaths = new StringBuilder(feedPathMask);
            if (metaPathMask != null) {
                feedBasePaths.append(FEED_PATH_SEP).append(metaPathMask);
            }
            if (statsPathMask != null) {
                feedBasePaths.append(FEED_PATH_SEP).append(statsPathMask);
            }
            if (tmpPathMask != null) {
                feedBasePaths.append(FEED_PATH_SEP).append(tmpPathMask);
            }

            props.put("feedDataPath", feedBasePaths.toString().replaceAll("\\$\\{", "\\?\\{"));
            props.put("timeZone", feed.getTimezone().getID());
            props.put("frequency", feed.getFrequency().getTimeUnit().name());
            props.put("limit", feedCluster.getRetention().getLimit().toString());
            props.put(ARG.operation.getPropName(), EntityOps.DELETE.name());
            props.put(ARG.feedNames.getPropName(), feed.getName());
            props.put(ARG.feedInstancePaths.getPropName(), "IGNORE");

            retentionWorkflow.setConfiguration(getCoordConfig(props));
            retentionAction.setWorkflow(retentionWorkflow);
            return retentionAction;
        } catch (IOException e) {
            throw new FalconException("Unable to create parent/retention workflow", e);
        }
View Full Code Here

    private ACTION getReplicationWorkflowAction(Cluster srcCluster, Cluster trgCluster, Path wfPath, String wfName)
        throws FalconException {

        ACTION replicationAction = new ACTION();
        WORKFLOW replicationWF = new WORKFLOW();
        try {
            replicationWF.setAppPath(getStoragePath(wfPath.toString()));
            Feed feed = getEntity();

            String srcPart = FeedHelper.normalizePartitionExpression(
                    FeedHelper.getCluster(feed, srcCluster.getName()).getPartition());
            srcPart = FeedHelper.evaluateClusterExp(srcCluster, srcPart);
            String targetPart = FeedHelper.normalizePartitionExpression(
                    FeedHelper.getCluster(feed, trgCluster.getName()).getPartition());
            targetPart = FeedHelper.evaluateClusterExp(trgCluster, targetPart);

            StringBuilder pathsWithPartitions = new StringBuilder();
            pathsWithPartitions.append("${coord:dataIn('input')}/").append(
                    FeedHelper.normalizePartitionExpression(srcPart, targetPart));

            Map<String, String> props = createCoordDefaultConfiguration(trgCluster, wfPath, wfName);
            props.put("srcClusterName", srcCluster.getName());
            props.put("srcClusterColo", srcCluster.getColo());
            props.put(ARG.feedNames.getPropName(), feed.getName());
            props.put(ARG.feedInstancePaths.getPropName(), pathsWithPartitions.toString());
            String parts = pathsWithPartitions.toString().replaceAll("//+", "/");
            parts = StringUtils.stripEnd(parts, "/");
            props.put("sourceRelativePaths", parts);
            props.put("distcpSourcePaths", "${coord:dataIn('input')}");
            props.put("distcpTargetPaths", "${coord:dataOut('output')}");
            props.put("falconInPaths", pathsWithPartitions.toString());
            props.put("falconInputFeeds", feed.getName());
            replicationWF.setConfiguration(getCoordConfig(props));
            replicationAction.setWorkflow(replicationWF);
        } catch (Exception e) {
            throw new FalconException("Unable to create replication workflow", e);
        }
        return replicationAction;
View Full Code Here

TOP

Related Classes of org.apache.falcon.oozie.coordinator.WORKFLOW

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.