<commit_before>/*
 * Created on Dec 23, 2006
 */
package org.griphyn.vdl.karajan;

import org.apache.log4j.Logger;
import org.globus.cog.karajan.stack.VariableStack;
import org.globus.cog.karajan.workflow.ElementTree;
import org.globus.cog.karajan.workflow.ExecutionContext;
import org.globus.cog.karajan.workflow.events.FailureNotificationEvent;
import org.griphyn.vdl.karajan.functions.ProcessBulkErrors;

public class VDL2ExecutionContext extends ExecutionContext {
	public static final Logger logger = Logger.getLogger(VDL2ExecutionContext.class);
	
	public static final String RUN_ID = "vdl:runid";
	public static final String SCRIPT_NAME = "vdl:scriptname";

	private String runID;
	private final String scriptName;

	public VDL2ExecutionContext(ElementTree tree, String scriptName) {
		super(tree);
		this.scriptName = scriptName;
	}

	protected void printFailure(FailureNotificationEvent e) {
		if (logger.isDebugEnabled()) {
			logger.debug(e.getMessage(), e.getException());
		}
		String msg = e.getMessage();
		if (!"Execution completed with errors".equals(msg)) {
			if (msg == null && e.getException() != null) {
				msg = getMeaningfulMessage(e.getException());
			}
			getStderr().append("Execution failed:\n\t");
			String translation = VDL2ErrorTranslator.getDefault().translate(msg);
			if (translation != null) {
				getStderr().append(translation);
			}
			else {<commit_msg>Log source element on error<commit_after>/*
 * Created on Dec 23, 2006
 */
package org.griphyn.vdl.karajan;

import org.apache.log4j.Logger;
import org.globus.cog.karajan.stack.VariableStack;
import org.globus.cog.karajan.workflow.ElementTree;
import org.globus.cog.karajan.workflow.ExecutionContext;
import org.globus.cog.karajan.workflow.events.FailureNotificationEvent;
import org.griphyn.vdl.karajan.functions.ProcessBulkErrors;

public class VDL2ExecutionContext extends ExecutionContext {
	public static final Logger logger = Logger.getLogger(VDL2ExecutionContext.class);
	
	public static final String RUN_ID = "vdl:runid";
	public static final String SCRIPT_NAME = "vdl:scriptname";

	private String runID;
	private final String scriptName;

	public VDL2ExecutionContext(ElementTree tree, String scriptName) {
		super(tree);
		this.scriptName = scriptName;
	}

	protected void printFailure(FailureNotificationEvent e) {
		if (logger.isDebugEnabled()) {
			logger.debug(e.getFlowElement() + ": " + e.getMessage(), e.getException());
		}
		String msg = e.getMessage();
		if (!"Execution completed with errors".equals(msg)) {
			if (msg == null && e.getException() != null) {
				msg = getMeaningfulMessage(e.getException());
			}
			getStderr().append("Execution failed:\n\t");
			String translation = VDL2ErrorTranslator.getDefault().translate(msg);
			if (translation != null) {
				getStderr().append(translation);
			}
			else {
{'fraction_non_alphanumeric': 0.1193502824858757, 'fraction_numerical': 0.007768361581920904, 'mean_word_length': 5.09247311827957, 'pattern_counts': {'":': 1, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7482972', 'n_tokens_mistral': 963, 'n_tokens_neox': 880, 'n_words': 187}