HttpRequestUtils.filterAdminOnlyFlowParams(this.userManager, options, user); final String message = this.executorManagerAdapter.submitExecutableFlow(exflow, user.getUserId()); ret.put("message", message); } catch (final Exception e) {
@Override public void doAction() throws Exception { if (projectManager == null || executorManagerAdapter == null) { throw new Exception("ExecuteFlowAction not properly initialized!"); } final Project project = FlowUtils.getProject(projectManager, this.projectId); final Flow flow = FlowUtils.getFlow(project, this.flowName); final ExecutableFlow exflow = FlowUtils.createExecutableFlow(project, flow); exflow.setSubmitUser(this.submitUser); if (this.executionOptions == null) { this.executionOptions = new ExecutionOptions(); } if (!this.executionOptions.isFailureEmailsOverridden()) { this.executionOptions.setFailureEmails(flow.getFailureEmails()); } if (!this.executionOptions.isSuccessEmailsOverridden()) { this.executionOptions.setSuccessEmails(flow.getSuccessEmails()); } exflow.setExecutionOptions(this.executionOptions); if (this.slaOptions != null && this.slaOptions.size() > 0) { exflow.setSlaOptions(this.slaOptions); } logger.info("Invoking flow " + project.getName() + "." + this.flowName); executorManagerAdapter.submitExecutableFlow(exflow, this.submitUser); logger.info("Invoked flow " + project.getName() + "." + this.flowName); }
@Before public void setup() throws Exception { final Project project = new Project(1, "test-project"); project.setFlows(ImmutableMap.of("test-flow", new Flow("test-flow"))); when(projectManager.getProject(1)).thenReturn(project); when(executorManagerAdapter.submitExecutableFlow(any(), any())) .thenThrow(new ExecutorManagerException("Flow is already running. Skipping execution.", ExecutorManagerException.Reason.SkippedExecution)); ExecuteFlowAction.setExecutorManager(this.executorManagerAdapter); ExecuteFlowAction.setProjectManager(this.projectManager); ExecuteFlowAction.setTriggerManager(this.triggerManager); final Props props = new Props(); props.put("trigger.scan.interval", 300); this.triggerManager = new TriggerManager(props, triggerLoader, executorManagerAdapter); this.triggerManager.registerCheckerType(ThresholdChecker.type, ThresholdChecker.class); this.triggerManager.registerActionType(DummyTriggerAction.type, DummyTriggerAction.class); this.triggerManager.start(); }
private void handleAjaxSubmitFlow(HttpServletRequest req, HashMap<String, Object> respMap, int execid) { try{ String execFlowJson = getParam(req, ExecutorManagerAdapter.INFO_EXEC_FLOW_JSON); ExecutableFlow exflow = ExecutableFlow.createExecutableFlowFromObject(JSONUtils.parseJSONFromString(execFlowJson)); String user = getParam(req, ExecutorManagerAdapter.INFO_USER_ID); executorManager.submitExecutableFlow(exflow, user); respMap.put(ExecutorManagerAdapter.INFO_EXEC_ID, exflow.getExecutionId()); } catch (Exception e) { e.printStackTrace(); respMap.put(ExecutorManagerAdapter.INFO_ERROR, e); } }
executorManager.submitExecutableFlow(exflow, submitUser);
@Override public void doAction() throws Exception { if (projectManager == null || executorManager == null) { throw new Exception("ExecuteFlowAction not properly initialized!"); } final Project project = FlowUtils.getProject(projectManager, this.projectId); final Flow flow = FlowUtils.getFlow(project, this.flowName); final ExecutableFlow exflow = FlowUtils.createExecutableFlow(project, flow); exflow.setSubmitUser(this.submitUser); if (this.executionOptions == null) { this.executionOptions = new ExecutionOptions(); } if (!this.executionOptions.isFailureEmailsOverridden()) { this.executionOptions.setFailureEmails(flow.getFailureEmails()); } if (!this.executionOptions.isSuccessEmailsOverridden()) { this.executionOptions.setSuccessEmails(flow.getSuccessEmails()); } exflow.setExecutionOptions(this.executionOptions); if (this.slaOptions != null && this.slaOptions.size() > 0) { exflow.setSlaOptions(this.slaOptions); } try { logger.info("Invoking flow " + project.getName() + "." + this.flowName); executorManager.submitExecutableFlow(exflow, this.submitUser); logger.info("Invoked flow " + project.getName() + "." + this.flowName); } catch (final ExecutorManagerException e) { throw new RuntimeException(e); } }
String message = executorManager.submitExecutableFlow(exflow, user.getUserId()); ret.put("message", message);