15 Commits

Author SHA1 Message Date
Lingxian Kong
a7496f4e16 Create trust for functions
When user creates function, qinling will create trust for the function
that can be used when function is invoked. This feature is especially
useful when the function is invoked by a trustee user.

Remove the trust for job accordingly because the job will always use
trust for the function.

Change-Id: I68c608a1f25f1008e13bff33325e7cd9914653ae
2017-10-06 13:57:31 +13:00
Lingxian Kong
d2dd717a2f Add session support for function
Also add the documentation.

Partially implements: blueprint qinling-support-user-session
Change-Id: Ic11b3b9f6ffe65bb08cfd880b81d41a40590919b
2017-09-25 00:56:45 +13:00
Lingxian Kong
f2189a0468 Fix logs query for executions
After function autoscaling support, it's impossible for qinling-engine
to get execution log because it doesn't know which pod it is talking
to.

So, it's neccessary for the runtime to return execution logs to
qinling engine.

The qinling client is not affected.

Change-Id: I96dfd00cc83d8b8a5e8c601ee3800b1ef1a45b1b
2017-08-29 23:54:30 +12:00
Lingxian Kong
c17a4b44da Concurrency support for python runtime
For testing purpose, just use multithreading support of Flask itself.

It's not recommended for production use.

Change-Id: I062c6f093e1c167a2ef9c8ad6747fc770e0139e8
2017-08-28 13:16:00 +12:00
Lingxian Kong
089f41de2b Support function execution log query
After execution is finished, Qinling provides API to query execution
log for audit, debug or other purposes.

Implements: blueprint qinling-logs
Change-Id: Ie92619bf238c8e72e15c350c65bfbbb88a065f97
2017-08-13 00:33:51 +12:00
Lingxian Kong
55c7e5f496 Do not get openstack session in container
If the function is triggered by job, it's very hard to get openstack
serssion based on trust id, unless the qinling service credentials are
passed which will lead to security issue.

So, this patch will remove 'context' param for user function.

Change-Id: Ib0e185ad9729cf59e308b7ded683911a92624ad0
2017-08-06 15:02:49 +12:00
Lingxian Kong
ff873c3f95 Fix authentication failure when token expires
OpenStack service session is generated when downloading code from
inside the container, but when the function is invoked at a deferred
time, the token may already be expiried.

Need to create the session when executing the function instead of
when downloading.

Change-Id: I8170bfb1c5f8b6cf88a744547db12cc12248aaca
2017-07-30 23:34:47 +12:00
Lingxian Kong
ebe601b8f5 Disable python buffer for stdout/stderr
Change-Id: I6f4a0aaf192df76d21c72529c92b6419c9f4b08d
2017-07-17 23:47:23 +12:00
Lingxian Kong
0f7520b88c Python runtime improvement
Change-Id: I8a77324df07c2d98773c20aa04eb81cc54152be3
2017-07-17 15:02:14 +12:00
Lingxian Kong
f870ac6871 Capture module load exception
Change-Id: I1f04351160fcdb0008a25f5898bfc6cc29a58055
2017-07-13 22:29:27 +12:00
Lingxian Kong
786f83d182 Support Keystone session in python runtime
Keystone session can be used directly in user function to access
OpenStack services.

Include openstack clients in python requirements as well.

Add a python function example.

Implements: blueprint qinling-openstack-clients
Change-Id: I4798c404cb57bafe14049f57ba8db7c7125106c7
2017-07-03 01:16:40 +12:00
Lingxian Kong
fa10083c3b Support to sepcify module.function for python function
Currenty, the function entry is hard-coded to be 'main.main' which is
not flexible. This patch adds support for specifying module name and
function name in the code package.

Change-Id: I92ea36f668073f380a4aef4526a6fad321d8cc95
2017-06-19 23:07:27 +12:00
Lingxian Kong
0d3ba2f7c8 Support python function input
For example:
http POST http://127.0.0.1:7070/v1/executions function_id=<FUNCTION_ID> input:='{"param1": "value1"}' X-Auth-Token:<TOKEN>

Change-Id: I04ead79c22ead5720eaab58f456568a7ed9b23b4
2017-06-15 22:59:27 +12:00
Lingxian Kong
b79b2791b8 Add swift object support for function creation
With this patch, users can create function using swift object:

http POST http://127.0.0.1:7070/v1/functions name=swift_function \
  runtime_id=xxx \
  code='{"source": "swift", "swift": {"container": "container_name", "object": "object_name"}}'

Implements: blueprint support-swift-object-as-code
2017-05-16 15:24:46 +12:00
Lingxian Kong
6c71504654 Add some documentation for Qinling
- Add README.rst
- Add Vagrantfile for Qinling trial.
- Rename python2.7 dir to python2
2017-05-14 00:00:09 +12:00