private static boolean useDefaultGroup(Execution execution) { Boolean useDefaultGroup = (Boolean) execution.getSystemContext().get(TempConstants.USE_DEFAULT_GROUP); if (useDefaultGroup == null) { return false; } return useDefaultGroup; }
private String getSplitId(List<Execution> newExecutions) { if (newExecutions != null && newExecutions.size() > 0) { return newExecutions.get(0).getSystemContext().getSplitId(); } throw new RuntimeException("Split executions list is null or empty!!!"); } }
private Serializable createBranchFailureEventData(Execution execution) { Map<String, Serializable> eventData = new HashMap<>(); eventData.put(ExecutionParametersConsts.SYSTEM_CONTEXT, execution.getSystemContext()); eventData.put(EventConstants.EXECUTION_ID_CONTEXT, execution.getExecutionId()); eventData.put(EventConstants.BRANCH_ID, execution.getSystemContext().getBranchId()); return (Serializable) eventData; }
/** * Returns true when the execution is a branch with the new branch mechanism * It will return true for executions of parallel, multi-instance, sub-flows and non blocking */ private boolean isBranch(Execution execution) { return execution != null && !StringUtils.isEmpty(execution.getSystemContext().getBranchId()); }
private static void addContextData(Map<String, Object> data, Execution execution) { data.putAll(execution.getContexts()); data.put(ExecutionParametersConsts.SYSTEM_CONTEXT, execution.getSystemContext()); data.put(ExecutionParametersConsts.EXECUTION_RUNTIME_SERVICES, execution.getSystemContext()); data.put(ExecutionParametersConsts.EXECUTION, execution); data.put(ExecutionParametersConsts.EXECUTION_CONTEXT, execution.getContexts()); data.put(ExecutionParametersConsts.RUNNING_EXECUTION_PLAN_ID, execution.getRunningExecutionPlanId()); }
private Serializable createFailureEventData(Execution execution) { Map<String, Serializable> eventData = new HashMap<>(); eventData.put(ExecutionParametersConsts.SYSTEM_CONTEXT, execution.getSystemContext()); eventData.put(EventConstants.EXECUTION_ID_CONTEXT, execution.getExecutionId()); eventData.put(EventConstants.BRANCH_ID, execution.getSystemContext().getBranchId()); eventData.put(ExecutionParametersConsts.RUNNING_EXECUTION_PLAN_ID, execution.getRunningExecutionPlanId()); return (Serializable) eventData; }
private Serializable createNoWorkerFailureEventData(Execution execution, Long pauseId) { String flowUuid = extractFlowUuid(execution.getRunningExecutionPlanId()); Map<String, Serializable> eventData = new HashMap<>(); eventData.put(ExecutionParametersConsts.SYSTEM_CONTEXT, execution.getSystemContext()); eventData.put(EventConstants.EXECUTION_ID_CONTEXT, execution.getExecutionId()); eventData.put(EventConstants.BRANCH_ID, execution.getSystemContext().getBranchId()); eventData.put(EventConstants.FLOW_UUID, flowUuid); eventData.put(EventConstants.PAUSE_ID, pauseId); return (Serializable) eventData; }
private Long findExecutionId(List<Execution> executions, String splitId) { for (Execution execution : executions) { if (execution.getSystemContext().getSplitId().equals(splitId)) { return execution.getExecutionId(); } } return null; }
private Long findExecutionId(List<Execution> executions, String splitId) { for (Execution execution : executions) { if (execution.getSystemContext().getSplitId().equals(splitId)) { return execution.getExecutionId(); } } return null; }
@Override public FinishedBranch convert(Execution execution) { boolean isBranchCancelled = ExecutionStatus.CANCELED.equals(execution.getSystemContext().getFlowTerminationType()); return new FinishedBranch(execution.getExecutionId().toString(), execution.getSystemContext().getBranchId(), execution.getSystemContext().getSplitId(), execution.getSystemContext().getStepErrorKey(), new BranchContexts(isBranchCancelled, execution.getContexts(), execution.getSystemContext())); } };
@Override public SystemContext extractSystemContext(byte[] executionObjectSerialized) { Execution execution = executionMessageConverter.extractExecution(new Payload(executionObjectSerialized)); return execution.getSystemContext(); }
private void updateMetadata(Execution execution, RunningExecutionPlan runningExecutionPlan) { Map<String, Serializable> executionMetadata = (Map<String, Serializable>) execution.getSystemContext() .getMetaData(); ExecutionPlan executionPlan = runningExecutionPlan.getExecutionPlan(); executionMetadata.put(ExecutionMetadataConsts.EXECUTION_PLAN_ID, executionPlan.getFlowUuid()); executionMetadata.put(ExecutionMetadataConsts.EXECUTION_PLAN_NAME, executionPlan.getName()); }
private void dumpBusEvents(Execution execution) throws InterruptedException { ArrayDeque<ScoreEvent> eventsQueue = execution.getSystemContext().getEvents(); if (eventsQueue == null) { return; } for (ScoreEvent eventWrapper : eventsQueue) { eventBus.dispatch(eventWrapper); } eventsQueue.clear(); }
public ScoreEvent createFinishedEvent(Execution execution) { String eventType = EventConstants.SCORE_FINISHED_EVENT; Serializable eventData = createFinishedEventData(execution); SystemContext systemContext = execution.getSystemContext(); return new ScoreEvent(eventType, systemContext.getLanguageName(), eventData, systemContext.getMetaData()); }
protected boolean handlePausedFlow(Execution execution) throws InterruptedException { String branchId = execution.getSystemContext().getBranchId(); PauseReason reason = findPauseReason(execution.getExecutionId(), branchId); if (reason != null) { // need to pause the execution pauseFlow(reason, execution); return true; } return false; }
public ScoreEvent createFailureEvent(Execution execution) { String eventType = EventConstants.SCORE_FAILURE_EVENT; Serializable eventData = createFailureEventData(execution); SystemContext systemContext = execution.getSystemContext(); return new ScoreEvent(eventType, systemContext.getLanguageName(), eventData, systemContext.getMetaData()); }
private boolean isCancelledExecution(Execution execution) { if(execution==null) return false; boolean executionIsCancelled = workerConfigurationService.isExecutionCancelled(execution.getExecutionId()); // in this case - just check if need to cancel. It will set as cancelled later on QueueEventListener // Another scenario of getting canceled - it was cancelled from the SplitJoinService (the configuration can still be not updated). Defect #:22060 if(ExecutionStatus.CANCELED.equals(execution.getSystemContext().getFlowTerminationType())) { executionIsCancelled = true; } return executionIsCancelled; }
public ScoreEvent createFailedBranchEvent(Execution execution) { String eventType = EventConstants.SCORE_BRANCH_FAILURE_EVENT; Serializable eventData = createBranchFailureEventData(execution); SystemContext systemContext = execution.getSystemContext(); return new ScoreEvent(eventType, systemContext.getLanguageName(), eventData, systemContext.getMetaData()); }
@Override public ScoreEvent createFinishedBranchEvent(Execution execution) { String eventType = EventConstants.SCORE_FINISHED_BRANCH_EVENT; Serializable eventData = createFinishedEventData(execution); SystemContext systemContext = execution.getSystemContext(); return new ScoreEvent(eventType, systemContext.getLanguageName(), eventData, systemContext.getMetaData()); }
private void addErrorMessage(ExecutionMessage message) { String group = message.getWorkerGroup(); Execution execution = converter.extractExecution(message.getPayload()); execution.getSystemContext().setNoWorkerInGroup(group); Payload payload = converter.createPayload(execution); message.setPayload(payload); }