Merge "Improve doc"

This commit is contained in:
Jenkins 2017-08-21 23:41:05 +00:00 committed by Gerrit Code Review
commit f3df0936d5
1 changed files with 27 additions and 27 deletions

View File

@ -34,7 +34,6 @@ host.
.. code-block:: console .. code-block:: console
$ kubectl proxy --accept-hosts='.*' --address='0.0.0.0' $ kubectl proxy --accept-hosts='.*' --address='0.0.0.0'
Starting to serve on [::]:8001 Starting to serve on [::]:8001
.. end .. end
@ -43,7 +42,7 @@ host.
.. code-block:: console .. code-block:: console
$ git clone https://github.com/LingxianKong/qinling.git $ git clone https://github.com/openstack/qinling.git
$ cd qinling/tools/vagrant $ cd qinling/tools/vagrant
.. end .. end
@ -75,23 +74,23 @@ host.
.. end .. end
If you see message like the above, congratulations! If you see message like the above, congratulations, your own Qinling service
is up and running!
Getting started with Qinling Getting started with Qinling
~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**Currently, you can interact with Qinling using python-qinlingclient or .. note::
sending RESTful API directly. Both ways are described in this guide.**
``httpie`` is a convenient tool to send HTTP request, make sure you installed Currently, you can interact with Qinling using python-qinlingclient or
``httpie`` via ``pip install httpie`` before playing with Qinling. sending RESTful API directly. Both ways are described in this guide.
``httpie`` is a convenient tool to send HTTP request, it has been installed
automatically inside the vagrnat VM.
If you prefer to use CLI, please make sure python-qinlingclient is installed. Perform following commands on your local host, we will create
runtime/function/execution during the process.
Perform following commands on your local host, the process will create 1. (Optional) Prepare a docker image including development environment for a
runtime/function/execution in Qinling.
#. (Optional) Prepare a docker image including development environment for a
specific programming language. For your convenience, I already build one specific programming language. For your convenience, I already build one
(``lingxiankong/python-runtime``) in my docker hub account that you could (``lingxiankong/python-runtime``) in my docker hub account that you could
directly use to create runtime in Qinling. Only ``Python 2`` runtime is directly use to create runtime in Qinling. Only ``Python 2`` runtime is
@ -108,9 +107,10 @@ runtime/function/execution in Qinling.
.. end .. end
#. Create runtime. A runtime in Qinling is running environment for a specific 2. Create runtime. ``runtime`` in Qinling is running environment for a
language, this resource is supposed to be created/deleted/updated by cloud specific language, this resource is supposed to be created/deleted/updated
operator. After creation, check the runtime status is ``available``: by cloud operator. After creation, check the runtime status until it's
``available`` before you execute any functions:
.. code-block:: console .. code-block:: console
@ -172,14 +172,14 @@ runtime/function/execution in Qinling.
.. end .. end
#. Create a customized function package: 3. Create a customized function package:
.. code-block:: console .. code-block:: console
$ mkdir ~/qinling_test $ mkdir ~/qinling_test
$ cat <<EOF > ~/qinling_test/main.py $ cat <<EOF > ~/qinling_test/main.py
import requests import requests
def main(): def main(*args, **kwargs):
r = requests.get('https://api.github.com/events') r = requests.get('https://api.github.com/events')
return len(r.json()) return len(r.json())
if __name__ == '__main__': if __name__ == '__main__':
@ -191,14 +191,14 @@ runtime/function/execution in Qinling.
.. end .. end
#. Create function, ``runtime_id`` comes from the output of above command: 4. Create function, ``runtime_id`` comes from the output of the above command:
.. code-block:: console .. code-block:: console
$ http -f POST http://192.168.33.18:7070/v1/functions name=github_test \ $ http -f POST http://192.168.33.18:7070/v1/functions name=github_test \
runtime_id=c1d78623-56bf-4487-9a72-1299b2c55e65 \ runtime_id=c1d78623-56bf-4487-9a72-1299b2c55e65 \
code='{"package": "true"}' \ code='{"package": "true"}' \
package@~/qinling_test/qinling_test.zip package@~/qinling_test/qinling_test.zip
HTTP/1.1 201 Created HTTP/1.1 201 Created
Connection: keep-alive Connection: keep-alive
@ -225,9 +225,9 @@ runtime/function/execution in Qinling.
.. code-block:: console .. code-block:: console
$ openstack function create github_test \ $ openstack function create github_test \
c1d78623-56bf-4487-9a72-1299b2c55e65 \ c1d78623-56bf-4487-9a72-1299b2c55e65 \
'{"source": "package"}' \ '{"source": "package"}' \
--package ~/qinling_test/qinling_test.zip --package ~/qinling_test/qinling_test.zip
+------------+--------------------------------------+ +------------+--------------------------------------+
| Field | Value | | Field | Value |
+------------+--------------------------------------+ +------------+--------------------------------------+
@ -243,12 +243,12 @@ runtime/function/execution in Qinling.
.. end .. end
#. Invoke the function by specifying ``function_id``: 5. Invoke the function by specifying ``function_id``:
.. code-block:: console .. code-block:: console
$ http POST http://192.168.33.18:7070/v1/executions \ $ http POST http://192.168.33.18:7070/v1/executions \
function_id=352e4c02-3c6b-4860-9b85-f72344b1f986 function_id=352e4c02-3c6b-4860-9b85-f72344b1f986
HTTP/1.1 201 Created HTTP/1.1 201 Created
Connection: keep-alive Connection: keep-alive
@ -290,4 +290,4 @@ runtime/function/execution in Qinling.
.. end .. end
If you invoke the same function again, you will find it is much faster If you invoke the same function again, you will find it is much faster
thanks to Qinling cache mechanism. due to Qinling cache mechanism.