{
"info": {
"author": "osterrfr@crim.ca",
"author_email": "vesta-support@crim.ca",
"bugtrack_url": null,
"classifiers": [
"Natural Language :: English",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.7"
],
"description": ".. _readme:\n\nNEP-143-2 Service Gateway\n=========================\n\nThis package offers a HTTP REST API to a distributed service queue Service\nGateway (SG). \n\nOverview\n--------\n\nIt's intended use is for the exploitation of services on the CANARIE network\nwhose services are CPU intensive and which would benefit from a dynamic\nhorizontal scaling approach to provide reasonable processing delays for the\nREST client and better reactivity of the interface itself.\n\nThe different functions offered by this code base are the following: \n\n* Provide a unified CANARIE REST interface for a collection of given services\n on a given infrastructure.\n\n* Provide a gateway to a queue-based distributed processing framework based on\n AMQP and Celery\n\n * A collection of utilities to aid in adding new worker types to the\n processing queues.\n * Implements a standard messaging scheme for workers / controller.\n * Passes arbitrary arguments onwards to the selected worker.\n\n* Provide an asynchronous API to query the advancement of long duration\n tasks.\n\n * Exposes methods to communicate progress [0-100] to the REST front-end.\n\n* Provides methods to evaluate infrastructure needs.\n\nThe documentation for this project can be found `here\n`_ .\n\nInfrastructure Overview\n-----------------------\n\nThis solution relies on the `Celery\n`_ distributed task queue\nand `RabbitMQ `_ messaging broker to dispatch\nprocessing requests. Also, the REST interface uses the `Flask\n`_ WEB framework.\n\nBasic Usage\n-----------\n\nInterface instantiation\n+++++++++++++++++++++++\n\n.. note:: Before starting the application, one must apply his own configuration\n values, see :ref:`configuration` section.\n\nFor validation purposes, usage is as follows:\n\n.. code-block:: bash\n\n python run_local.py --help\n\nThis command can launch a built-in Flask WEB server. The\n\u00ab-d\u00bb options launches the WEB server in debug mode. Debug mode is useful for\nautomatic reloading of code and stack trace forwarding. See the Flask\ndocumentation for more information.\n\n.. Warning::\n\n The REST interface in run_local / debug mode uses a built-in Web Server.\n While this Web Server is useful for a closed environment, it is not\n recommended as a Web Server for a production environment. Care should be\n taken to configure a `WSGI\n `_ gateway to a\n production-ready WebServer such as `Apache `_ or\n `GUnicorn `_ behind a reverse-proxy server such as\n NGinx.\n\n\nCommand line client calls\n+++++++++++++++++++++++++\n\n.. TODO:: Fold back this information in the Users's guide or at least merge the\n two.\n\nA practical way to interact with the REST API is to use the `curl\n`_ command.\n\nIn a new terminal window, issue the following command:\n\n.. code-block:: bash\n\n curl http://localhost:5000/annotator/annotate\\\n --data-urlencode doc_url=http://some.url.wav\\\n --data-urlencode ann_doc_id=\\\n --header \"Authorization: \"\n\nWhere is a JWT encoded key. For testing purposes a helper script can\nbe invoked with the following command to generate a valid JWT:\n\n.. code-block:: bash\n\n python -m VestaRestPackage.jwt_\n\nOr if a :ref:`Multimedia Storage System (MSS)` is configured\nproperly in install_config.ini you can use a valid storage_doc_id for document\nuploaded to this MSS as follows:\n\n.. code-block:: bash\n\n curl http://localhost:5000/annotator/annotate/\\\n --data-urlencode ann_doc_id= --header \"Authorization: \"\n\n\nWhere \u00abannotator\u00bb would be the name of a given service and \u00absome.url.wav\u00bb\nindicates the location of a document to process. A uuid would then be returned\nand a task request should have been sent on the worker queue where a service\nworker could have consumed the request and launched the processing. \n\nWhen complete, the annotations will be available through the *status* route.\nThe *status* route can be invoked as follows:\n\n.. code-block:: bash\n\n curl http://localhost:5000/annotator/status\\?uuid=\n\nWhen invoking the *annotate* route, if the optional ann_doc_id argument is\nsupplied, the worker will post the annotations on an :ref:`annotation storage\nservice ` for the given annotation document UUID. If an error\noccurred when trying to store the annotations, the worker task would have\nfailed and the annotation process result would be lost.\n\nFurthermore, Celery provides a monitor which can be viewed through a WEB\ninterface and which also provides a REST API which can be used to monitor and\ncontrol tasks. This monitor is named Celery Flower. The use of Flower is\nentirely optional at this point but might be included in the run-time\nrequirements further on. Flower can be started in the following manner:\n\n.. code-block:: bash\n\n celery flower --config=\\\n --broker_api=http://:/api/\n\nWhere and should be set to point to the AMQP broker.\n is the base name of a Python module providing configuration options to\naccess the broker. Example contents might be the following:\n\n.. code-block:: python\n\n BROKER_URL = 'amqp://localhost//'\n CELERY_RESULT_BACKEND = 'amqp://'\n CELERY_TASK_SERIALIZER = 'json'\n CELERY_RESULT_SERIALIZER = 'json'\n CELERY_ACCEPT_CONTENT = ['json']\n\nOf course should be configured to point to the actual broker being\nused, which may or may not be the same as the one providing the broker API\nspecified on the command line above.\n\nSee section :any:`celery_config_wrapper` for a helper module if you want to\nreuse configuration values for Flower from values extracted from the\napplication configuration.\n\nFurther information on the REST API can be obtained in the documentation's User\nGuide.\n\n\n\n\nHistory\n=======\n\n1.8.6\n-----\n\n* Updated VestaRestPackage to 1.9.3\n\n1.8.5\n-----\n\n* Updated VestaRestPackage to 1.9.2\n\n1.8.4\n-----\n\n* Updated VestaRestPackage to 1.9.1 with MonboDB support.\n\n1.8.3\n-----\n\n* Fix handling of worker exceptions encoded in UTF-8.\n\n1.8.2\n-----\n\n* Configuration directive no_params_needed is now optionnal.\n\n1.8.1\n-----\n\n* Fix handling of case where JSON is submitted and no_params_needed = False.\n\n1.8.0\n-----\n\n* Can use a JSON body subitted to the process route.\n* Configuration for a service can contain a no_parameter directive.\n* Fixes to error handling for certain types of exceptions. \n\n1.7.6\n-----\n\n* Can use a task name a number of times on different queues.\n\n1.7.3\n-----\n\n* Fix version declaration when called by WSGI.\n\n1.7.2\n-----\n\n* Fix bug in arbitrary parameter use.\n\n1.7.0\n-----\n\n* Arbitrary arguments which are unknown are passed onwards to the worker through the \"misc\" sub-structure in JSON.\n\n1.6.0\n-----\n\n* First packaged release\n* Deployment configuration factored out of package\n\n\n1.5.5\n-----\n\n* HTTP Authorization mechanism with JWT sent through HEADER on annotation requests.\n* Redirect to documentation pages which are to be statically hosted elsewhere\n* Can handle extra document specification in URL arguments (\\*_url or storage\\_\\*_id)\n\n\n1.5.4\n-----\n\n* Add a ./service/. route to reflect CANARIE API requirements.\n\n\n1.5.3\n-----\n\n* Use a version of transition 1.1.0 and faceanalysis 1.0.0 services that\n conform to the JSON-lD scheme.\n\n1.5.0\n-----\n\n* Error handling is completed\n* Uniform error codes\n* More logs\n* Normalise some fields in the result structure\n\n1.4.0\n-----\n\n* Support of storage_doc_id replacing the full URL \n* Queue will expires in 2 hours by default: Add a Status of EXPIRED when a queue is no longer available\n* Complete the annotations storage for a given ann_doc_id\n* Task UUIDs are stored using a method that supports concurrency\n\n1.3.0\n-----\n\n* Support ann_doc_id argument.\n* New versioning scheme.\n\n1.1.0\n-----\n\n* Add a cancel function to stop a running task.\n\n\n",
"description_content_type": "",
"docs_url": null,
"download_url": "",
"downloads": {
"last_day": -1,
"last_month": -1,
"last_week": -1
},
"home_page": "http://www.crim.ca",
"keywords": "CANARIE,LoadBalancing,Services",
"license": "copyright CRIM 2015",
"maintainer": "",
"maintainer_email": "",
"name": "ServiceGateway",
"package_url": "https://pypi.org/project/ServiceGateway/",
"platform": "linux-x86_64",
"project_url": "https://pypi.org/project/ServiceGateway/",
"project_urls": {
"Homepage": "http://www.crim.ca"
},
"release_url": "https://pypi.org/project/ServiceGateway/1.8.6/",
"requires_dist": [
"python-novaclient (==2.23.2)",
"VestaRestPackage (==1.9.3)"
],
"requires_python": "",
"summary": ".. _readme:",
"version": "1.8.6"
},
"last_serial": 4963814,
"releases": {
"1.7.5": [
{
"comment_text": "",
"digests": {
"md5": "11d647b55ae3f3c5c6224a56c736317e",
"sha256": "b0a7fbca427dcdb7bc43e4faf707f546826c5b0001f3283662b765052d35cfe0"
},
"downloads": -1,
"filename": "ServiceGateway-1.7.5-py2-none-any.whl",
"has_sig": false,
"md5_digest": "11d647b55ae3f3c5c6224a56c736317e",
"packagetype": "bdist_wheel",
"python_version": "py2",
"requires_python": null,
"size": 19717,
"upload_time": "2018-01-31T16:21:44",
"url": "https://files.pythonhosted.org/packages/ef/7c/183dd29635d6382c8f79e8fda94b8844d6787fb2da402c7d0b1eae2a1810/ServiceGateway-1.7.5-py2-none-any.whl"
}
],
"1.8.4": [
{
"comment_text": "",
"digests": {
"md5": "3428da5723560f41a0ba7c3ca62e3b12",
"sha256": "21aca8661ae1361a4c8d663ec575e8e42df1fd373092008a481795144e1610f4"
},
"downloads": -1,
"filename": "ServiceGateway-1.8.4-py2-none-any.whl",
"has_sig": false,
"md5_digest": "3428da5723560f41a0ba7c3ca62e3b12",
"packagetype": "bdist_wheel",
"python_version": "py2",
"requires_python": null,
"size": 15486,
"upload_time": "2019-02-25T17:25:40",
"url": "https://files.pythonhosted.org/packages/a0/e6/5746bd70883ac4a923100027e46f0f9342e02d36f639d608e14c9c5c87af/ServiceGateway-1.8.4-py2-none-any.whl"
}
],
"1.8.5": [
{
"comment_text": "",
"digests": {
"md5": "4ce9d48ea6fc19c5eae376144971ec9a",
"sha256": "74ebd80ca5ce502d0078f7ddc004affc5e8b02b1b6ff09152c095989c251f049"
},
"downloads": -1,
"filename": "ServiceGateway-1.8.5-py2-none-any.whl",
"has_sig": false,
"md5_digest": "4ce9d48ea6fc19c5eae376144971ec9a",
"packagetype": "bdist_wheel",
"python_version": "py2",
"requires_python": null,
"size": 15490,
"upload_time": "2019-02-26T18:19:15",
"url": "https://files.pythonhosted.org/packages/48/3c/788e2a6ca6cb227bbcff1938533b49c26c4cb9e37e6982db636d2113781b/ServiceGateway-1.8.5-py2-none-any.whl"
}
],
"1.8.6": [
{
"comment_text": "",
"digests": {
"md5": "dd67596093cda9c2a8a34c7b29df6d86",
"sha256": "545263011d35a783dae4d89f65240c1cc04a0dab527d5991f8c4daa7641cb66a"
},
"downloads": -1,
"filename": "ServiceGateway-1.8.6-py2-none-any.whl",
"has_sig": false,
"md5_digest": "dd67596093cda9c2a8a34c7b29df6d86",
"packagetype": "bdist_wheel",
"python_version": "py2",
"requires_python": null,
"size": 15497,
"upload_time": "2019-03-20T13:47:27",
"url": "https://files.pythonhosted.org/packages/81/14/c7c95302f5add12441906c4be09f4d7dd11a3024115ae409252c21fe5370/ServiceGateway-1.8.6-py2-none-any.whl"
}
]
},
"urls": [
{
"comment_text": "",
"digests": {
"md5": "dd67596093cda9c2a8a34c7b29df6d86",
"sha256": "545263011d35a783dae4d89f65240c1cc04a0dab527d5991f8c4daa7641cb66a"
},
"downloads": -1,
"filename": "ServiceGateway-1.8.6-py2-none-any.whl",
"has_sig": false,
"md5_digest": "dd67596093cda9c2a8a34c7b29df6d86",
"packagetype": "bdist_wheel",
"python_version": "py2",
"requires_python": null,
"size": 15497,
"upload_time": "2019-03-20T13:47:27",
"url": "https://files.pythonhosted.org/packages/81/14/c7c95302f5add12441906c4be09f4d7dd11a3024115ae409252c21fe5370/ServiceGateway-1.8.6-py2-none-any.whl"
}
]
}