Package azkaban.flow

Examples of azkaban.flow.FlowExecutionHolder


        this.flowDeserializer = flowDeserializer;
    }

    @Override
    public FlowExecutionHolder apply(Map<String, Object> descriptor) {
        final FlowExecutionHolder retVal;

        // Maintain backwards compatibility, check if it's really a holder
        final Object type = descriptor.get("type");
        if (type != null && "FlowExecutionHolder".equals(type.toString())) {
            retVal = new FlowExecutionHolder(
                    flowDeserializer.apply(Verifier.getVerifiedObject(descriptor, "flow", Map.class)),
                    new Props(new Props(), Verifier.getVerifiedObject(descriptor, "parentProps", Map.class))
            );
        }
        else {
            retVal = new FlowExecutionHolder(
                    flowDeserializer.apply(descriptor),
                    new Props()
            );
        }
View Full Code Here


          page.add("action", "run");
          page.add("joblist", createJsonJobList(displayFlow));
        }
        else if (hasParam(req, "id")) {
          long id = Long.parseLong(getParam(req, "id"));
             FlowExecutionHolder holder = allFlows.loadExecutableFlow(id);
          ExecutableFlow executableFlow = holder.getFlow();

          // This will be used the other
          Flow displayFlow = new Flow(executableFlow.getName(), (Props)null);
          fillFlow(displayFlow, executableFlow);
          displayFlow.validateFlow();
View Full Code Here

              disabledJobs.add(disabled);
            }
          }
         
          long id = Long.parseLong(getParam(req, "id"));
             FlowExecutionHolder holder = allFlows.loadExecutableFlow(id);
          //Flows.resetFailedFlows(holder.getFlow());
         
          // Disable all proper values
          ExecutableFlow executableFlow = holder.getFlow();
          traverseFlow(disabledJobs, executableFlow);
         
        PrintWriter writer = resp.getWriter();
        JSONUtils jsonUtils = new JSONUtils();
        HashMap<String,Object> results = new HashMap<String,Object>();
       
          try {
            this.getApplication().getJobExecutorManager().execute(holder);
            results.put("id", holder.getFlow().getId());
            results.put("success", true);
            results.put("message", String.format("Executing Flow[%s].", id));
          } catch(Exception e) {
            results.put("id", holder.getFlow().getId());
            results.put("error", true);
            results.put("message", String.format("Error running Flow[%s]. " + e.getMessage(), id));
          }
         
          writer.print(jsonUtils.toJSONString(results));
View Full Code Here

      if (isExecuting(flow.getName())) {
        throw new JobExecutionException("Job " + flow.getName() + " is already running.");
      }
     
        final Props parentProps = produceParentProperties(flow);
        FlowExecutionHolder holder = new FlowExecutionHolder(flow, parentProps);
        logger.info("Executing job '" + flow.getName() + "' now");

        final JobExecution executingJob = new JobExecution(flow.getName(),
                                                       new DateTime(),
                                                       true);
View Full Code Here

        if (hasParam(req, "action")) {
            if ("restart".equals(getParam(req, "action")) && hasParam(req, "id")) {
                try {
                    long id = Long.parseLong(getParam(req, "id"));

                    final FlowExecutionHolder holder = allFlows.loadExecutableFlow(id);

                    if (holder == null) {
                        addMessage(req, String.format("Unknown flow with id[%s]", id));
                    }
                    else {
                        Flows.resetFailedFlows(holder.getFlow());
                        this.getApplication().getJobExecutorManager().execute(holder);

                        addMessage(req, String.format("Flow[%s] restarted.", id));
                    }
                }
                catch (NumberFormatException e) {
                    addMessage(req, String.format("Apparently [%s] is not a valid long.", getParam(req, "id")));
                }
                catch (JobExecutionException e) {
                  addMessage(req, "Error restarting " + getParam(req, "id") + ". " + e.getMessage());
                }
            }
        }

        long currMaxId = allFlows.getCurrMaxId();

        String beginParam = req.getParameter("begin");
        int begin = beginParam == null? 0 : Integer.parseInt(beginParam);
       
        String sizeParam = req.getParameter("size");
        int size = sizeParam == null? 20 : Integer.parseInt(sizeParam);

        List<ExecutableFlow> execs = new ArrayList<ExecutableFlow>(size);
        for (int i = begin; i < begin + size; i++) {
            final FlowExecutionHolder holder = allFlows.loadExecutableFlow(currMaxId - i);
            ExecutableFlow flow = null;
            if (holder != null)
                flow = holder.getFlow();

            if (flow != null)
                execs.add(flow);
        }
View Full Code Here

TOP

Related Classes of azkaban.flow.FlowExecutionHolder

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.