diff --git a/README.rst b/README.rst index 06cef275..4cc20838 100644 --- a/README.rst +++ b/README.rst @@ -181,7 +181,7 @@ runtime/function/execution in Qinling. main() EOF $ pip install requests -t ~/qinling_test - $ zip ~/qinling_test/qinling_test.zip ~/qinling_test/* + $ zip -r ~/qinling_test/qinling_test.zip ~/qinling_test/* .. end diff --git a/qinling/api/controllers/v1/execution.py b/qinling/api/controllers/v1/execution.py index 7a923450..d9afbd8d 100644 --- a/qinling/api/controllers/v1/execution.py +++ b/qinling/api/controllers/v1/execution.py @@ -76,11 +76,12 @@ class ExecutionsController(rest.RestController): db_model = db_api.create_execution(params) - self.engine_client.create_execution( - db_model.id, function_id, runtime_id, - input=params.get('input'), - is_sync=is_sync - ) + if not func_url: + self.engine_client.create_execution( + db_model.id, function_id, runtime_id, + input=params.get('input'), + is_sync=is_sync + ) if is_sync: db_model = db_api.get_execution(db_model.id) diff --git a/runtimes/python2/README.md b/runtimes/python2/README.md index 277a6efa..4ebd8c37 100644 --- a/runtimes/python2/README.md +++ b/runtimes/python2/README.md @@ -12,7 +12,7 @@ in their function packages through Qinling API or CLI. You'll need access to a Docker registry to push the image, by default it's docker hub. After modification, build a new image and upload to docker hub: - docker build -t USER/python-runtime. && docker push USER/python-runtime + docker build -t USER/python-runtime . && docker push USER/python-runtime ## Using the image in Qinling diff --git a/runtimes/python2/server.py b/runtimes/python2/server.py index b077cef7..3a140bee 100644 --- a/runtimes/python2/server.py +++ b/runtimes/python2/server.py @@ -33,7 +33,7 @@ file_name = '' def download(): download_url = request.form['download_url'] function_id = request.form['function_id'] - token = request.form['token'] + token = request.form.get('token') headers = {} if token: @@ -67,9 +67,17 @@ def execute(): importer = zipimport.zipimporter(file_name) module = importer.load_module('main') + input = {} + if request.form: + # Refer to: + # http://werkzeug.pocoo.org/docs/0.12/datastructures/#werkzeug.datastructures.MultiDict + input = request.form.to_dict() + + app.logger.debug('Invoking function with input: %s' % input) + start = time.time() try: - result = module.main() + result = module.main(**input) except Exception as e: result = str(e)