@Override protected void configure() { setName(phaseSpec.getPhaseName()); setDescription("CustomAction phase executor. " + phaseSpec.getPhaseName()); // add source, sink, transform ids to the properties. These are needed at runtime to instantiate the plugins Map<String, String> properties = new HashMap<>(); properties.put(Constants.PIPELINEID, GSON.toJson(phaseSpec)); setProperties(properties); }
if (pluginTypes.contains(Action.PLUGIN_TYPE)) { programAdder.addAction(new PipelineAction(batchPhaseSpec)); } else if (pluginTypes.contains(Condition.PLUGIN_TYPE)) {
@Override public void run() throws Exception { CustomActionContext context = getContext(); Map<String, String> properties = context.getSpecification().getProperties(); BatchPhaseSpec phaseSpec = GSON.fromJson(properties.get(Constants.PIPELINEID), BatchPhaseSpec.class); PipelinePhase phase = phaseSpec.getPhase(); StageSpec stageSpec = phase.iterator().next(); PluginContext pluginContext = new PipelinePluginContext(context, metrics, phaseSpec.isStageLoggingEnabled(), phaseSpec.isProcessTimingEnabled()); PipelineRuntime pipelineRuntime = new PipelineRuntime(context, metrics); Action action = pluginContext.newPluginInstance(stageSpec.getName(), new DefaultMacroEvaluator(pipelineRuntime.getArguments(), context.getLogicalStartTime(), context, context.getNamespace())); ActionContext actionContext = new BasicActionContext(context, pipelineRuntime, stageSpec); if (!context.getDataTracer(stageSpec.getName()).isEnabled()) { action.run(actionContext); } WorkflowToken token = context.getWorkflowToken(); if (token == null) { throw new IllegalStateException("WorkflowToken cannot be null when action is executed through Workflow."); } for (Map.Entry<String, String> entry : pipelineRuntime.getArguments().getAddedArguments().entrySet()) { token.put(entry.getKey(), entry.getValue()); } } }