Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
6999935
Restore python 2.7 runtime.
rabbah Jul 20, 2021
e27ee5f
Update requirements.txt and docker files for Nimbella remote builds.
rabbah Jul 20, 2021
682da51
Updating Python SDK to latest release.
jthomas Aug 6, 2021
6e714d6
Make reference to nimbella install symbolic (#1)
joshuaauerbachwatson Dec 10, 2021
a88c582
Remove signal-fx libraries (#2)
joshuaauerbachwatson Jan 11, 2022
ad7940f
Fail when curl download of nim fails (#3)
joshuaauerbachwatson Jan 21, 2022
529b2f1
Log the sentinels in the child process rather than the proxy process …
markusthoemmes Mar 15, 2022
6a4e02f
SERVERLESS-1465 Update Golang version to more recent one (#5)
markusthoemmes May 25, 2022
f1d52d3
SERVERLESS-1395 Implement prelaunch behavior for the Python runtime (#7)
markusthoemmes Jun 23, 2022
605ea88
Include functions deployer in runtime image (#9)
joshuaauerbachwatson Oct 30, 2022
df7eb79
remove nim install (#10)
joshuaauerbachwatson Nov 10, 2022
bd3380b
Align akka dependencies to allow us to run tests (#13)
markusthoemmes Dec 1, 2022
692db6c
SERVERLESS-2327 Map environment into a context parameter (#11)
markusthoemmes Dec 2, 2022
307cc21
Fix the env name to __OW_API_KEY (#14)
markusthoemmes Dec 2, 2022
d7a83be
SERVERLESS-2388 Add support for function signatures - no param and re…
Jan 4, 2023
4f45506
SERVERLESS-2491 Rename action -> function in error messages (#16)
markusthoemmes Jan 25, 2023
a682793
SERVERLESS-2773 Add a Python 3.11 runtime (#17)
markusthoemmes Apr 24, 2023
08249cc
SERVERLESS-3565: Fix python runtime and update daft to v0.4.8 source …
sdharav Jan 16, 2026
f34e798
SERVERLESS-3565: Include Python 311 in the Travis publish pipeline
sdharav Jan 16, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 5 additions & 21 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,29 +39,13 @@ script:
- "./tools/travis/build.sh && ./tools/travis/test.sh"
deploy:
- provider: script
script: "./tools/travis/publish.sh openwhisk ${TRAVIS_TAG%@*} ${TRAVIS_TAG##*@}"
script: "./tools/travis/publish.sh nimbella 3 ${TRAVIS_TAG} && ./tools/travis/publish.sh nimbella 3-ai ${TRAVIS_TAG} && ./tools/travis/publish.sh nimbella 39 ${TRAVIS_TAG} **&& ./tools/travis/publish.sh nimbella 311 ${TRAVIS_TAG}**"
on:
tags: true
all_branches: true
repo: apache/openwhisk-runtime-python
repo: nimbella-corp/openwhisk-runtime-python
- provider: script
script: "./tools/travis/publish.sh openwhisk 3 nightly && ./tools/travis/publish.sh openwhisk 3-ai nightly"
script: "./tools/travis/publish.sh nimbella 3 nightly && ./tools/travis/publish.sh nimbella 3-ai nightly && ./tools/travis/publish.sh nimbella 39 nightly **&& ./tools/travis/publish.sh nimbella 311 nightly**"
on:
branch: master
repo: apache/openwhisk-runtime-python
env:
global:
- secure: Ac7MlWUpsLwmbcjCigDf+vftiXAEJbf78FVm2QCd4IeFqlRiNbQm3bWRXOOW3Zqh4R4o/wSFpFq0qKPrI9WJjOcxD0GxFboq2iGWTegddfDbENV/IBmjurl6NzYY6dUB7GUSmHYy6tdKnxMhjHzZCn2m4OVWltcMtnOV0G+uYvbnre7vXfb67duzJF+mYpJJ7rC0wGh+N50bYvm0BTtPcQMYJibq6sDTY8Lr1b74QGdM/sODre69CbuiwAA7Ed0hajEcMkv8YnwY0De/PL7hthUyCWSD+i1AhtD+3odA64yX/pAbBzfCcqPoI0Nt5ZmAAUKLJ9pAHCc74dlmYzj9wj1z5TS0nLOE2l++vNvgsA3/c+lqrBv6hc9FmSKx4yfNdFCakVLEfdRJw/45ibIRN5dCW5tDdIx8aciBV8c0CyYgSLRvtVuvw5IX7fbwhHOZ8ftTRzCHS0Nd9zs4x3za+1aucWFQEyrkPtXZIiqeuV7yI4S7yYhGeJy/3KmuN7ljDiTElZb/W9W22ryw/UwCy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TPP44YquxOCgAFn+CZjes9Jm+vz5lk5Azksi48yiHwFiLYZo5gcnwr2n2IspjBs6db10rkCe693vIpoW4T3KujMIKwVXrgUl4pDME1nN/loEBHm0DjKoeOD13DHqITMTPX4sR94TCGf0lMyaag/JOETdDgC9hAbh4aSx1cj4hGXiuGrNMbYblMBsjvujqFp2nraw/DE93pHGRY9lbBZIjEVhj/jBmOv1I3yRdXHj4VybZc4JGnfQVGz/RYDOEmKGoLoVWFp+hGAHDqVos9ZvEBByMAAmgVD2/D5cBER3oskp/JJjKmFLk614FcNh4D7/+bYAFhxbCgnoLHH5GeSo0q73O3JSi5pZggEIN9xis7SVQgPl+MUDTe5N3X3J3bQc7cMYGLzh0VNSyYaHuW2P02vWBNE/FAkL8UGrfGsXnDyGRRxo8fYHTXpIjhIkE7tY5eZQ=
on_pull_requests: false
on_success: change
on_failure: always
webhooks:
urls:
# travis2slack webhook to enable DMs on openwhisk-team.slack.com to PR authors with TravisCI results
secure: "JoCPajRbNQ+8Tpu7XyjtLT/pbbA4vhEpScYs7YIE4+iYtZLNXpqXdX/9+tzX9uGsh/+4DoIVMXjcKjDKglgtffgv8RF1wVblIpC8pIcPVaUxWn1KitjZCgFEQnxpT74DgJng3C1ADHon5htNdZ/vhfXDtV6XJ1/mvtWJZCC0ZsWuvRiwnRwZdIkrZi7Fpl6fqTOOAcy7KV8IeKi+GMInjvPrVdG3uLgQO2tOnoKK4oFvDT1sV3hLX8nx6GYAers98AtbvNyiSyg4wAUFV6HTiF7Kc4rHWqPgu8aQRfO8yTlZ4XomAHR1HcujANgoG1lvij28N7pkgRvjUBpPP82qYKlx4xC9RxeH40MjlYiCLHWUswyFb9QGRsnbGtCamME3kBiC3jO86avvD16PWwCbA1q/Y7bLhUZUCUOGHzxvb3n2kCgkcjcbwIiS8+/2aJsIJ8TE7Y6sjrMHJEGILO57gY/JdCrevn4MOfnyCiqPgWdnPTUzcXcYoH/hZctUsOISc2M5yZsNAVHyHFZAbDDdgCLAVi9SAIRhB9ipn/JbpnHzPhu7eW46T6cDMdBAw0FUPvrGch20qhABILU7cFCDZLJ/DouKGAOn1XPXo5FUBjyM854jjm2jVs6IpOdUecW1lGdafB3d0AJXMm4vBXU8VmCuvElurnoE+FNpKZpmjms="


branch: dev
repo: nimbella-corp/openwhisk-runtime-python
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

# Apache OpenWhisk runtimes for Python
[![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](http://www.apache.org/licenses/LICENSE-2.0)
[![Build Status](https://travis-ci.com/apache/openwhisk-runtime-python.svg?branch=master)](https://travis-ci.com/apache/openwhisk-runtime-python)
[![Build Status](https://travis-ci.com/nimbella-corp/openwhisk-runtime-python.svg?branch=master)](https://travis-ci.com/nimbella-corp/openwhisk-runtime-python)

## Build Runtimes

Expand Down
18 changes: 14 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,26 @@
* limitations under the License.
*/



buildscript {
repositories {
jcenter()
mavenCentral()
gradlePluginPortal()
}
dependencies {
classpath "cz.alenkacz:gradle-scalafmt:${gradle.scalafmt.version}"
// Dependencies for the build script itself go here
}
}

plugins {
id "cz.alenkacz.gradle.scalafmt" version "1.16.2" apply false
}

subprojects {
apply plugin: 'scalafmt'
scalafmt.configFilePath = gradle.scalafmt.config
// Only apply if the project is a Scala project or has the property
if (project.name.contains("scala") || project.hasProperty('scalafmt')) {
apply plugin: 'cz.alenkacz.gradle.scalafmt'
scalafmt.configFilePath = gradle.scalafmt.config
}
}
91 changes: 91 additions & 0 deletions core/python2ActionLoop/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

# build go proxy from source
FROM golang:1.15 AS builder_source
ARG GO_PROXY_GITHUB_USER=nimbella-corp
ARG GO_PROXY_GITHUB_BRANCH=dev
RUN git clone --branch ${GO_PROXY_GITHUB_BRANCH} \
https://github.com/${GO_PROXY_GITHUB_USER}/openwhisk-runtime-go /src ;\
cd /src ; env GO111MODULE=on CGO_ENABLED=0 go build main/proxy.go && \
mv proxy /bin/proxy

# or build it from a release
FROM golang:1.15 AS builder_release
ARG GO_PROXY_RELEASE_VERSION=1.15@1.17.0
RUN curl -sL \
https://github.com/apache/openwhisk-runtime-go/archive/{$GO_PROXY_RELEASE_VERSION}.tar.gz\
| tar xzf -\
&& cd openwhisk-runtime-go-*/main\
&& GO111MODULE=on go build -o /bin/proxy

FROM python:2.7-alpine

# select the builder to use
ARG GO_PROXY_BUILD_FROM=source

# Upgrade and install basic Python dependencies
RUN apk add --no-cache \
bash \
build-base \
bzip2-dev \
curl \
gcc \
libc-dev \
libxslt-dev \
libxml2-dev \
libffi-dev \
linux-headers \
openssl-dev \
python-dev

# Install common modules for python
RUN pip install --no-cache-dir --upgrade pip setuptools six \
&& pip install --no-cache-dir \
gevent==1.3.6 \
flask==1.0.2 \
beautifulsoup4==4.6.3 \
httplib2==0.11.3 \
kafka_python==1.4.3 \
lxml==4.2.5 \
python-dateutil==2.7.3 \
requests==2.19.1 \
scrapy==1.5.1 \
simplejson==3.16.0 \
virtualenv==16.0.0 \
twisted==18.7.0

# install nim
ARG NIM_INSTALL_SCRIPT=https://apigcp.nimbella.io/downloads/nim/nim-install-linux.sh
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN curl ${NIM_INSTALL_SCRIPT} | bash

RUN mkdir -p /action
WORKDIR /
COPY --from=builder_source /bin/proxy /bin/proxy_source
COPY --from=builder_release /bin/proxy /bin/proxy_release
RUN mv /bin/proxy_${GO_PROXY_BUILD_FROM} /bin/proxy

ADD bin/compile /bin/compile
ADD lib/launcher.py /lib/launcher.py
# the compiler script
ENV OW_COMPILER=/bin/compile
# log initialization errors
ENV OW_LOG_INIT_ERROR=1
# the launcher must wait for an ack
ENV OW_WAIT_FOR_ACK=1
ENTRYPOINT ["/bin/proxy"]
31 changes: 31 additions & 0 deletions core/python2ActionLoop/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
IMG=whisk/actionloop-python-v2.7:latest

build:
docker build -t $(IMG) -f Dockerfile .

clean:
docker rmi -f $(IMG)

debug:
docker run -p 8080:8080 \
-ti --entrypoint=/bin/bash -v $(PWD):/mnt \
-e OW_COMPILER=/mnt/bin/compile \
$(IMG)

.PHONY: build clean debug
115 changes: 115 additions & 0 deletions core/python2ActionLoop/bin/compile
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
#!/usr/bin/env python
"""Python Action Builder
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
"""

from __future__ import print_function
import os, os.path, sys, imp, ast, shutil, subprocess, traceback
from os.path import abspath, exists, dirname

# write a file creating intermediate directories
def write_file(file, body, executable=False):
try: os.makedirs(dirname(file), mode=0o755)
except: pass
with open(file, mode="wb") as f:
f.write(body)
if executable:
os.chmod(file, 0o755)

# copy a file eventually replacing a substring
def copy_replace(src, dst, match=None, replacement=""):
with open(src, 'rb') as s:
body = s.read()
if match:
body = body.replace(match, replacement)
write_file(dst, body)

# assemble sources
def sources(launcher, main, src_dir):
# move exec in the right place if exists
src_file = "%s/exec" % src_dir
if exists(src_file):
os.rename(src_file, "%s/__main__.py" % src_dir)
if exists("%s/__main__.py" % src_dir):
os.rename("%s/__main__.py" % src_dir, "%s/main__.py" % src_dir)

# write the boilerplate in a temp dir
copy_replace(launcher, "%s/exec__.py" % src_dir,
"from main__ import main as main",
"from main__ import %s as main" % main )

# compile sources
def build(src_dir, tgt_dir):
# in general, compile your program into an executable format
# for scripting languages, move sources and create a launcher
# move away the action dir and replace with the new
shutil.rmtree(tgt_dir)
shutil.move(src_dir, tgt_dir)
tgt_file = "%s/exec" % tgt_dir
write_file(tgt_file, """#!/bin/bash
if [[ "$__OW_EXECUTION_ENV" == "" || "$(cat $0.env)" == "$__OW_EXECUTION_ENV" ]]
then cd "$(dirname $0)"
exec /usr/local/bin/python exec__.py "$@"
else echo "Execution Environment Mismatch"
echo "Expected: $(cat $0.env)"
echo "Actual: $__OW_EXECUTION_ENV"
exit 1
fi
""", True)
if os.environ.get("__OW_EXECUTION_ENV"):
write_file("%s.env"%tgt_file, os.environ['__OW_EXECUTION_ENV'])
return tgt_file

#check if a module exists
def check(tgt_dir, module_name):
try:

# find module
mod = imp.find_module(module_name, [tgt_dir])
# parse module
ast.parse(mod[0].read())
# check virtualenv
path_to_virtualenv = abspath('%s/virtualenv' % tgt_dir)
if os.path.isdir(path_to_virtualenv):
activate_this_file = path_to_virtualenv + '/bin/activate_this.py'
if not os.path.exists(activate_this_file):
# check if this was packaged for windows
activate_this_file = path_to_virtualenv + '/Scripts/activate_this.py'
if not os.path.exists(activate_this_file):
sys.stderr.write("Invalid virtualenv. Zip file does not include 'activate_this.py'.\n")
except ImportError:
sys.stderr.write("Zip file does not include %s\n" % module_name)
except SyntaxError as er:
sys.stderr.write(er.msg)
except Exception as ex:
sys.stderr.write(ex.message)
sys.stderr.flush()

if __name__ == '__main__':
if len(sys.argv) < 4:
sys.stdout.write("usage: <main-function> <source-dir> <target-dir>\n")
sys.stdout.flush()
sys.exit(1)
launcher = "%s/lib/launcher.py" % dirname(dirname(sys.argv[0]))
src_dir = abspath(sys.argv[2])
tgt_dir = abspath(sys.argv[3])
sources(launcher, sys.argv[1], src_dir)
tgt = build(abspath(sys.argv[2]), tgt_dir)
check(tgt_dir, "main__")
sys.stdout.flush()
sys.stderr.flush()
19 changes: 19 additions & 0 deletions core/python2ActionLoop/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

ext.dockerImageName = 'actionloop-python-v2.7'
apply from: '../../gradle/docker.gradle'
Loading