Examples of Workflow


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

        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

Examples of org.apache.helix.task.Workflow

  }

  @Test
  public void stopAndResume() throws Exception {
    Map<String, String> commandConfig = ImmutableMap.of(TIMEOUT_CONFIG, String.valueOf(100));
    Workflow flow =
        WorkflowGenerator.generateDefaultSingleJobWorkflowBuilderWithExtraConfigs(JOB_RESOURCE,
            commandConfig).build();

    LOG.info("Starting flow " + flow.getName());
    _driver.start(flow);
    TestUtil.pollForWorkflowState(_manager, JOB_RESOURCE, TaskState.IN_PROGRESS);

    LOG.info("Pausing job");
    _driver.stop(JOB_RESOURCE);
View Full Code Here

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

    }

    private ACTION getRetentionWorkflowAction(Cluster cluster, Path wfPath, String wfName) throws IvoryException {
        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.ivory.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 (Exception e) {
            throw new IvoryException("Unable to create parent/retention workflow", e);
        }
View Full Code Here

Examples of org.apache.lenya.cms.workflow.Workflow

        String fileName = WORKFLOW_DIRECTORY + source;
        File workflowFile = new File(publicationDirectory, fileName);
       
        WorkflowBuilderFactory factory = new WorkflowBuilderFactory();
        WorkflowBuilder builder = factory.createBuilder();
        Workflow workflow;
       
        try {
            workflow = builder.buildWorkflow(workflowFile);
        }
        catch (WorkflowBuildException e) {
View Full Code Here

Examples of org.apache.lenya.workflow.Workflow

        assert publication != null;
        assert(workflowFileName != null) && !"".equals(workflowFileName);

        File workflowDirectory = new File(publication.getDirectory(), WORKFLOW_DIRECTORY);
        File workflowFile = new File(workflowDirectory, workflowFileName);
        Workflow workflow = WorkflowBuilder.buildWorkflow(workflowFile);

        return workflow;
    }
View Full Code Here

Examples of org.apache.oodt.cas.workflow.structs.Workflow

                    "workflowmgr.getWorkflowsByEvent", argList);

            if (workflowVector != null) {
                for (Iterator i = workflowVector.iterator(); i.hasNext();) {
                    Hashtable workflowHash = (Hashtable) i.next();
                    Workflow w = XmlRpcStructFactory
                            .getWorkflowFromXmlRpc(workflowHash);
                    workflows.add(w);
                }
            }
View Full Code Here

Examples of org.apache.oodt.cas.workflow.structs.Workflow

        argList.add(workflowId);

        try {
            Hashtable workflow = (Hashtable) client.execute(
                    "workflowmgr.getWorkflowById", argList);
            Workflow w = XmlRpcStructFactory.getWorkflowFromXmlRpc(workflow);
            return w;
        } catch (XmlRpcException e) {
            e.printStackTrace();
            throw new Exception(e.getMessage());
        } catch (IOException e) {
View Full Code Here

Examples of org.apache.oodt.cas.workflow.structs.Workflow

            if (works != null) {
                workflows = new Vector(works.size());

                for (Iterator i = works.iterator(); i.hasNext();) {
                    Hashtable workflw = (Hashtable) i.next();
                    Workflow w = XmlRpcStructFactory
                            .getWorkflowFromXmlRpc(workflw);
                    workflows.add(w);
                }

                return workflows;
View Full Code Here

Examples of org.apache.oodt.cas.workflow.structs.Workflow

            try {
                workflows = client.getWorkflows();

                if (workflows != null) {
                    for (Iterator i = workflows.iterator(); i.hasNext();) {
                        Workflow w = (Workflow) i.next();
                        System.out.println("Workflow: [id=" + w.getId()
                                + ", name=" + w.getName() + ", numTasks="
                                + w.getTasks().size() + "]");
                    }
                }
            } catch (Exception e) {
                e.printStackTrace();
                throw new RuntimeException(e);
            }
        } else if (operation.equals("--getTaskById")) {
            String taskId = null;

            for (int i = 4; i < args.length; i++) {
                if (args[i].equals("--id")) {
                    taskId = args[++i];
                }
            }

            if (taskId == null) {
                System.err.println(getTaskByIdOperation);
                System.exit(1);
            }

            // create the client
            XmlRpcWorkflowManagerClient client = new XmlRpcWorkflowManagerClient(
                    new URL(url));

            WorkflowTask task = null;

            try {
                task = client.getTaskById(taskId);
                System.out.println("Task: [id=" + task.getTaskId() + ", name="
                        + task.getTaskName() + ", order=" + task.getOrder()
                        + ", class=" + task.getClass().getName()
                        + ", numConditions=" + task.getConditions().size()
                        + ", configuration="
                        + task.getTaskConfig().getProperties() + "]");
            } catch (Exception e) {
                e.printStackTrace();
                throw new RuntimeException(e);
            }

        } else if (operation.equals("--getConditionById")) {
            String conditionId = null;

            for (int i = 4; i < args.length; i++) {
                if (args[i].equals("--id")) {
                    conditionId = args[++i];
                }
            }

            if (conditionId == null) {
                System.err.println(getConditionByIdOperation);
                System.exit(1);
            }

            // create the client
            XmlRpcWorkflowManagerClient client = new XmlRpcWorkflowManagerClient(
                    new URL(url));

            WorkflowCondition condition = null;

            try {
                condition = client.getConditionById(conditionId);
                System.out.println("Condition: [id="
                        + condition.getConditionId() + ", name="
                        + condition.getConditionName() + ", order="
                        + condition.getOrder() + ", class="
                        + condition.getClass().getName() + "]");
            } catch (Exception e) {
                e.printStackTrace();
                throw new RuntimeException(e);
            }
        } else if (operation.equals("--getWorkflowById")) {
            String workflowId = null;

            for (int i = 4; i < args.length; i++) {
                if (args[i].equals("--id")) {
                    workflowId = args[++i];
                }
            }

            if (workflowId == null) {
                System.err.println(getWorkflowByIdOperation);
                System.exit(1);
            }

            // create the client
            XmlRpcWorkflowManagerClient client = new XmlRpcWorkflowManagerClient(
                    new URL(url));

            Workflow workflow = null;

            try {
                workflow = client.getWorkflowById(workflowId);
                System.out.println("Workflow: [id=" + workflow.getId()
                        + ", name=" + workflow.getName() + ", numTasks="
                        + workflow.getTasks().size() + "]");
            } catch (Exception e) {
                e.printStackTrace();
                throw new RuntimeException(e);
            }
        } else if (operation.equals("--getRegisteredEvents")) {
            XmlRpcWorkflowManagerClient client = new XmlRpcWorkflowManagerClient(
                    new URL(url));

            List events = null;

            try {
                events = client.getRegisteredEvents();

                if (events != null) {
                    for (Iterator i = events.iterator(); i.hasNext();) {
                        String event = (String) i.next();
                        System.out.println("Event: [name=" + event + "]");
                    }
                }
            } catch (Exception e) {
                e.printStackTrace();
                throw new RuntimeException(e);
            }
        } else if (operation.equals("--getWorkflowsByEvent")) {
            XmlRpcWorkflowManagerClient client = new XmlRpcWorkflowManagerClient(
                    new URL(url));

            List workflows = null;

            String eventName = null;

            for (int i = 4; i < args.length; i++) {
                if (args[i].equals("--eventName")) {
                    eventName = args[++i];
                }
            }

            if (eventName == null) {
                System.err.println(getWorkflowsByEventOperation);
                System.exit(1);
            }

            try {
                workflows = client.getWorkflowsByEvent(eventName);

                if (workflows != null) {
                    for (Iterator i = workflows.iterator(); i.hasNext();) {
                        Workflow w = (Workflow) i.next();
                        System.out.println("Workflow: [id=" + w.getId()
                                + ", name=" + w.getName() + ", numTasks="
                                + w.getTasks().size() + "]");
                    }
                }
            } catch (Exception e) {
                e.printStackTrace();
                throw new RuntimeException(e);
View Full Code Here

Examples of org.apache.oodt.cas.workflow.structs.Workflow

        try {
            workflows = repo.getWorkflowsForEvent(eventName);

            if (workflows != null) {
                for (Iterator i = workflows.iterator(); i.hasNext();) {
                    Workflow w = (Workflow) i.next();
                    Hashtable workflow = XmlRpcStructFactory
                            .getXmlRpcWorkflow(w);
                    workflowList.add(workflow);
                }
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.