Class: Jets::PolyFun::PythonExecutor

Inherits:
BaseExecutor show all
Defined in:
lib/jets/poly_fun/python_executor.rb

Instance Method Summary collapse

Methods inherited from BaseExecutor

#cleanup, #copy_src_to_temp, #create_tmpdir, #handler, #initialize, #lambda_executor_script, #run, #run_lambda_executor, #write

Constructor Details

This class inherits a constructor from Jets::PolyFun::BaseExecutor

Instance Method Details

#codeObject

Code for wrapper script that mimics lambda execution. Wrapper script usage:

python WRAPPER_SCRIPT EVENT

Example:

python /tmp/jets/demo/executor/20180804-12816-imqb9/lambda_executor.py '{}'


10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/jets/poly_fun/python_executor.rb', line 10

def code
  <<-EOL
import sys
import json
from #{@task.meth} import #{handler}
event = json.loads(sys.argv[1])
context = {}
resp = #{handler}(event, context)
result = json.dumps(resp)
print(result)
EOL
end