conductor-worker-python/pyexecplugins/Eval.py

23 lines
608 B
Python

from pyexecplugins.pyexecplugins import PyExecPlugin
import logging;
class Plugin(PyExecPlugin):
name = "Eval"
taskdef = {
"name" : "pyeval",
"description" : "Execute arbitrary python code",
"inputKeys" : ["code"],
"outputKeys" : ["result"],
"ownerEmail" : "m.lettere@gmail.com"
}
def __init__(self, data=None, config=None):
super().__init__(data, config)
def execute(self):
code = self.data.get("code")
if code != None:
ret = eval(code, { "data" : self.data})
return { "result" : ret }