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
  "import sys\nimport json\nfrom \#{@task.meth} import \#{handler}\nevent = json.loads(sys.argv[1])\ncontext = {}\nresp = \#{handler}(event, context)\nresult = json.dumps(resp)\nprint(result)\n"
end