diff options
Diffstat (limited to 'plugins/plugins-executor/plugins-executor-jython/src')
2 files changed, 12 insertions, 8 deletions
diff --git a/plugins/plugins-executor/plugins-executor-jython/src/main/java/org/onap/policy/apex/plugins/executor/jython/JythonTaskExecutor.java b/plugins/plugins-executor/plugins-executor-jython/src/main/java/org/onap/policy/apex/plugins/executor/jython/JythonTaskExecutor.java index b0dd9c5c9..71dce5801 100644 --- a/plugins/plugins-executor/plugins-executor-jython/src/main/java/org/onap/policy/apex/plugins/executor/jython/JythonTaskExecutor.java +++ b/plugins/plugins-executor/plugins-executor-jython/src/main/java/org/onap/policy/apex/plugins/executor/jython/JythonTaskExecutor.java @@ -26,6 +26,7 @@ import org.onap.policy.apex.context.ContextException; import org.onap.policy.apex.core.engine.executor.TaskExecutor; import org.onap.policy.apex.core.engine.executor.exception.StateMachineException; import org.python.core.CompileMode; +import org.python.core.CompilerFlags; import org.python.core.Py; import org.python.core.PyCode; import org.python.core.PyException; @@ -34,8 +35,8 @@ import org.slf4j.ext.XLogger; import org.slf4j.ext.XLoggerFactory; /** - * The Class JythonTaskExecutor is the task executor for task logic written in Jython It is unlikely that this is thread - * safe. + * The Class JythonTaskExecutor is the task executor for task logic written in Jython It is unlikely + * that this is thread safe. * * @author Liam Fallon (liam.fallon@ericsson.com) */ @@ -61,8 +62,9 @@ public class JythonTaskExecutor extends TaskExecutor { super.prepare(); try { synchronized (Py.class) { - compiled = Py.compile_flags(getSubject().getTaskLogic().getLogic(), - "<" + getSubject().getKey().toString() + ">", CompileMode.exec, null); + final String logic = getSubject().getTaskLogic().getLogic(); + final String filename = "<" + getSubject().getKey().toString() + ">"; + compiled = Py.compile_flags(logic, filename, CompileMode.exec, new CompilerFlags()); } } catch (final PyException e) { LOGGER.warn("failed to compile Jython code for task " + getSubject().getKey().getID(), e); diff --git a/plugins/plugins-executor/plugins-executor-jython/src/main/java/org/onap/policy/apex/plugins/executor/jython/JythonTaskSelectExecutor.java b/plugins/plugins-executor/plugins-executor-jython/src/main/java/org/onap/policy/apex/plugins/executor/jython/JythonTaskSelectExecutor.java index 4fd48f2e7..d28001d87 100644 --- a/plugins/plugins-executor/plugins-executor-jython/src/main/java/org/onap/policy/apex/plugins/executor/jython/JythonTaskSelectExecutor.java +++ b/plugins/plugins-executor/plugins-executor-jython/src/main/java/org/onap/policy/apex/plugins/executor/jython/JythonTaskSelectExecutor.java @@ -26,6 +26,7 @@ import org.onap.policy.apex.core.engine.executor.TaskSelectExecutor; import org.onap.policy.apex.core.engine.executor.exception.StateMachineException; import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; import org.python.core.CompileMode; +import org.python.core.CompilerFlags; import org.python.core.Py; import org.python.core.PyCode; import org.python.core.PyException; @@ -34,8 +35,8 @@ import org.slf4j.ext.XLogger; import org.slf4j.ext.XLoggerFactory; /** - * The Class JythonTaskSelectExecutor is the task selection executor for task selection logic written in Jython It is - * unlikely that this is thread safe. + * The Class JythonTaskSelectExecutor is the task selection executor for task selection logic + * written in Jython It is unlikely that this is thread safe. * * @author Liam Fallon (liam.fallon@ericsson.com) */ @@ -60,8 +61,9 @@ public class JythonTaskSelectExecutor extends TaskSelectExecutor { super.prepare(); try { synchronized (Py.class) { - compiled = Py.compile_flags(getSubject().getTaskSelectionLogic().getLogic(), - "<" + getSubject().getKey().toString() + ">", CompileMode.exec, null); + final String logic = getSubject().getTaskSelectionLogic().getLogic(); + final String filename = "<" + getSubject().getKey().toString() + ">"; + compiled = Py.compile_flags(logic, filename, CompileMode.exec, new CompilerFlags()); } } catch (final PyException e) { LOGGER.warn("failed to compile Jython code for task selection logic in " + getSubject().getKey().getID(), |