You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by wi...@apache.org on 2020/08/17 15:46:10 UTC
[incubator-streampipes] branch dev updated: [STREAMPIPES-174]
switch to waitress for serving, fixed some minors
This is an automated email from the ASF dual-hosted git repository.
wiener pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git
The following commit(s) were added to refs/heads/dev by this push:
new 4c07b97 [STREAMPIPES-174] switch to waitress for serving, fixed some minors
4c07b97 is described below
commit 4c07b979db8253b1e1a4470e97391cd01e99569c
Author: Patrick Wiener <wi...@fzi.de>
AuthorDate: Mon Aug 17 17:45:49 2020 +0200
[STREAMPIPES-174] switch to waitress for serving, fixed some minors
---
streampipes-wrapper-python/requirements.txt | 2 +-
streampipes-wrapper-python/setup.py | 2 +-
streampipes-wrapper-python/streampipes/api/resources/base.py | 3 ++-
streampipes-wrapper-python/streampipes/api/rest.py | 6 +++---
streampipes-wrapper-python/streampipes/core.py | 2 +-
streampipes-wrapper-python/streampipes/declarer.py | 10 +++++-----
6 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/streampipes-wrapper-python/requirements.txt b/streampipes-wrapper-python/requirements.txt
index 4ebe9a9..7c51160 100644
--- a/streampipes-wrapper-python/requirements.txt
+++ b/streampipes-wrapper-python/requirements.txt
@@ -1,4 +1,4 @@
-bjoern==3.1.0
+waitress==-1.4.4
certifi==2020.6.20
chardet==3.0.4
click==7.1.2
diff --git a/streampipes-wrapper-python/setup.py b/streampipes-wrapper-python/setup.py
index a4e074c..89b69ea 100644
--- a/streampipes-wrapper-python/setup.py
+++ b/streampipes-wrapper-python/setup.py
@@ -43,7 +43,7 @@ setup(
'Flask==1.1.2',
'flask-classful==0.14.2',
'Flask-Negotiate==0.1.0',
- 'bjoern==3.1.0',
+ 'waitress==1.4.4',
'python-consul==1.1.0'
],
tests_require=[],
diff --git a/streampipes-wrapper-python/streampipes/api/resources/base.py b/streampipes-wrapper-python/streampipes/api/resources/base.py
index 76f92f4..ebee17e 100644
--- a/streampipes-wrapper-python/streampipes/api/resources/base.py
+++ b/streampipes-wrapper-python/streampipes/api/resources/base.py
@@ -16,7 +16,7 @@
#
import abc
import os
-from flask import jsonify, make_response
+from flask import jsonify, make_response, request
from flask_classful import FlaskView, route
from flask_negotiate import consumes
@@ -85,6 +85,7 @@ class InvocableElement(Element):
def invoke_runtime(self, element_id: str):
# TODO: parse invocation graph
# payload = request.json
+ print(request.json)
resp = {'element_id': element_id, 'status': 'sucess'}
return make_response(jsonify(resp), 200)
diff --git a/streampipes-wrapper-python/streampipes/api/rest.py b/streampipes-wrapper-python/streampipes/api/rest.py
index 61d828d..9f47a4d 100644
--- a/streampipes-wrapper-python/streampipes/api/rest.py
+++ b/streampipes-wrapper-python/streampipes/api/rest.py
@@ -17,7 +17,7 @@
""" API endpoints """
import threading
-import bjoern
+from waitress import serve
from flask import Flask
from streampipes.api.resources.dummy import DummyInterimsResource
@@ -44,6 +44,6 @@ class PipelineElementApi(object):
DummyInterimsResource.register(self.app, route_base='/')
def run(self, port: int):
- print('serving API via bjoern WSGI server ... http://{}:{}'.format('0.0.0.0', port))
- threading.Thread(target=bjoern.run, args=(self.app,), kwargs={'host': '0.0.0.0', 'port': int(port)}).start()
+ print('serving API via waitress WSGI server ... http://{}:{}'.format('0.0.0.0', port))
+ threading.Thread(target=serve, args=(self.app,), kwargs={'host': '0.0.0.0', 'port': int(port), '_quiet': True}).start()
diff --git a/streampipes-wrapper-python/streampipes/core.py b/streampipes-wrapper-python/streampipes/core.py
index cf21c91..543f5d7 100644
--- a/streampipes-wrapper-python/streampipes/core.py
+++ b/streampipes-wrapper-python/streampipes/core.py
@@ -24,7 +24,7 @@ from confluent_kafka import Producer, Consumer
class EventProcessor(object):
- __metaclass__ = abc.ABC0
+ __metaclass__ = abc.ABC
_DEFAULT_KAFKA_CONSUMER_CONFIG = {
'bootstrap.servers': 'kafka:9092',
diff --git a/streampipes-wrapper-python/streampipes/declarer.py b/streampipes-wrapper-python/streampipes/declarer.py
index 35c0b17..40ab810 100644
--- a/streampipes-wrapper-python/streampipes/declarer.py
+++ b/streampipes-wrapper-python/streampipes/declarer.py
@@ -51,10 +51,10 @@ class DeclarerSingleton(metaclass=Singleton):
def get(cls):
return cls._processors
- # def get_declarers(self):
- # return self.sepa_declarers
- #
- # def get_base_uri(self):
- # return 'http://' + self.host + ':' + self.port + self.route
+ def get_declarers(self):
+ return self.sepa_declarers
+
+ def get_base_uri(self):
+ return 'http://' + self.host + ':' + self.port + self.route