From 61308e1c104fd6f63ef813928675e8561fa683cc Mon Sep 17 00:00:00 2001 From: Julien_P Date: Thu, 31 Jan 2019 19:43:42 +0100 Subject: [PATCH] adding gevent and eventlet for socketio --- appserver.py | 6 ++++++ package-lock.json | 16 ---------------- requirements.txt | 5 +++++ .../_core/queries_db/query_insert_doc.py | 6 +++--- solidata_api/application.py | 1 + wsgi.py | 8 ++++++++ wsgi_preprod.py | 8 ++++++++ 7 files changed, 31 insertions(+), 19 deletions(-) delete mode 100644 package-lock.json diff --git a/appserver.py b/appserver.py index db98dc5..d874778 100644 --- a/appserver.py +++ b/appserver.py @@ -20,6 +20,10 @@ from log_config import log, pformat # log.debug('>>> TESTING LOGGER') +### + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ### +### FLASK-SOCKETIO +### + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ### +from flask_socketio import SocketIO ### + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ### ### RUN APPSERVER @@ -79,6 +83,8 @@ def app_runner(mode, host, port) : app_debug = app.config["DEBUG"] + ### initiate socketio + socketio = SocketIO(app) # simple flask runner print() diff --git a/package-lock.json b/package-lock.json deleted file mode 100644 index 971fc39..0000000 --- a/package-lock.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "requires": true, - "lockfileVersion": 1, - "dependencies": { - "crypto": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/crypto/-/crypto-1.0.1.tgz", - "integrity": "sha512-VxBKmeNcqQdiUQUW2Tzq0t377b54N2bMtXO/qiLa+6eRRmmC4qT3D4OnTGoT/U6O9aklQ/jTwbOtRMTTY8G0Ig==" - }, - "js-nacl": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/js-nacl/-/js-nacl-1.3.2.tgz", - "integrity": "sha512-XEV2slQ60lLhtL8X+PfFYFfen3b0eg+IU3deWKXKF285nqAf/f24Z15LvlLkVogpAb/9eAxe7o1AtThhKGvQkg==" - } - } -} diff --git a/requirements.txt b/requirements.txt index e891060..ad0a413 100644 --- a/requirements.txt +++ b/requirements.txt @@ -7,6 +7,8 @@ cloudpickle==0.6.1 colorlog==4.0.2 dask==1.1.0 distributed==1.25.2 +dnspython==1.16.0 +eventlet==0.24.1 Flask==1.0.2 Flask-Cors==3.0.7 Flask-JWT-Extended==3.15.0 @@ -16,6 +18,8 @@ flask-restplus==0.12.1 Flask-SocketIO==3.2.1 geographiclib==1.49 geopy==1.18.1 +gevent==1.4.0 +greenlet==0.4.15 gunicorn==19.9.0 HeapDict==1.0.0 idna==2.8 @@ -25,6 +29,7 @@ jsonschema==2.6.0 llvmlite==0.27.0 locket==0.2.0 MarkupSafe==1.1.0 +monotonic==1.5 msgpack==0.6.0 numba==0.42.0 numpy==1.16.0 diff --git a/solidata_api/_core/queries_db/query_insert_doc.py b/solidata_api/_core/queries_db/query_insert_doc.py index 032f6f4..c795b9c 100644 --- a/solidata_api/_core/queries_db/query_insert_doc.py +++ b/solidata_api/_core/queries_db/query_insert_doc.py @@ -49,12 +49,12 @@ def Query_db_insert ( ### check if doc already exists document = db_collection.find_one( filter_doc ) - log.debug('document : \n%s', pformat(document) ) + # log.debug('document : \n%s', pformat(document) ) ### retrieve system user's OID system_user = db_dict_by_type['usr'].find_one( { 'auth.role' : user_role } ) - log.debug('system_user : \n%s', pformat(system_user) ) + # log.debug('system_user : \n%s', pformat(system_user) ) # check if system user exists # system_user exists @@ -75,7 +75,7 @@ def Query_db_insert ( ### marshall infos with new_doc complete model new_doc_in = marshal( new_doc , models["model_doc_in"]) - log.debug('new_doc_in : \n%s', pformat(new_doc_in) ) + # log.debug('new_doc_in : \n%s', pformat(new_doc_in) ) ### complete missing default fields if document_type != "usr" : diff --git a/solidata_api/application.py b/solidata_api/application.py index ae079ac..eac7661 100644 --- a/solidata_api/application.py +++ b/solidata_api/application.py @@ -10,6 +10,7 @@ from flask import Flask, g, current_app + ### + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ### ### FLASK-EXTENDED-JWT IMPORTS ### + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ### diff --git a/wsgi.py b/wsgi.py index c0dfe82..bc87a5b 100644 --- a/wsgi.py +++ b/wsgi.py @@ -3,6 +3,11 @@ from log_config import log, pformat +### + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ### +### FLASK-SOCKETIO +### + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ### +from flask_socketio import SocketIO + from solidata_api.application import create_app app = create_app( app_name='SOLIDATA_API', run_mode="prod" ) @@ -11,4 +16,7 @@ log.debug("\n--- STARTING SOLIDATA API (PROD) ---\n") + ### initiate socketio + socketio = SocketIO(app) + app.run() \ No newline at end of file diff --git a/wsgi_preprod.py b/wsgi_preprod.py index e23e546..7b69167 100644 --- a/wsgi_preprod.py +++ b/wsgi_preprod.py @@ -3,6 +3,11 @@ from log_config import log, pformat +### + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ### +### FLASK-SOCKETIO +### + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ### +from flask_socketio import SocketIO + from solidata_api.application import create_app app = create_app( app_name='SOLIDATA_API', run_mode="preprod" ) @@ -11,4 +16,7 @@ log.debug("\n--- STARTING SOLIDATA API (PREPROD) ---\n") + ### initiate socketio + socketio = SocketIO(app) + app.run() \ No newline at end of file