From 5be176b25e376ab9bd3140eb1fd7c98326fa3f28 Mon Sep 17 00:00:00 2001 From: Justin Berstler <bjustin@us.ibm.com> Date: Mon, 13 Feb 2017 11:59:48 -0500 Subject: [PATCH] Add kafka_python library to the Python action runtime (#1829) * Add kafka_python library to the Python action runtime * Update doc and Python package sniff test Please squash into previous commit --- core/pythonAction/Dockerfile | 1 + .../src/actionContainers/PythonActionContainerTests.scala | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/core/pythonAction/Dockerfile b/core/pythonAction/Dockerfile index 677c6261..e096e8e9 100644 --- a/core/pythonAction/Dockerfile +++ b/core/pythonAction/Dockerfile @@ -15,6 +15,7 @@ RUN apk add --no-cache \ RUN pip install \ beautifulsoup4==4.5.1 \ httplib2==0.9.2 \ + kafka_python==1.3.1 \ lxml==3.6.4 \ python-dateutil==2.5.3 \ requests==2.11.1 \ diff --git a/tests/src/actionContainers/PythonActionContainerTests.scala b/tests/src/actionContainers/PythonActionContainerTests.scala index 94bb4b98..e62b7b3b 100644 --- a/tests/src/actionContainers/PythonActionContainerTests.scala +++ b/tests/src/actionContainers/PythonActionContainerTests.scala @@ -210,6 +210,7 @@ class PythonActionContainerTests extends BasicActionRunnerTests with WskActorSys |import simplejson as json |from twisted.internet import protocol, reactor, endpoints |import socket + |from kafka import BrokerConnection | |def main(args): | socket.setdefaulttimeout(120) @@ -218,6 +219,7 @@ class PythonActionContainerTests extends BasicActionRunnerTests with WskActorSys | t = parse('2016-02-22 11:59:00 EST') | r = requests.get('https://openwhisk.ng.bluemix.net/api/v1') | j = json.dumps({'foo':'bar'}, separators = (',', ':')) + | kafka = BrokerConnection("it works", 9093, None) | | return { | "bs4": str(b.title), @@ -225,7 +227,8 @@ class PythonActionContainerTests extends BasicActionRunnerTests with WskActorSys | "dateutil": t.strftime("%A"), | "lxml": etree.Element("root").tag, | "json": j, - | "request": r.status_code + | "request": r.status_code, + | "kafka_python": kafka.host | } """.stripMargin @@ -242,7 +245,8 @@ class PythonActionContainerTests extends BasicActionRunnerTests with WskActorSys "dateutil" -> "Monday".toJson, "lxml" -> "root".toJson, "json" -> JsObject("foo" -> "bar".toJson).compactPrint.toJson, - "request" -> 200.toJson))) + "request" -> 200.toJson, + "kafka_python" -> "it works".toJson))) } checkStreams(out, err, { -- GitLab