Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix process runtime with extra dependencies and re-enable python inte…
…gration tests (#2926) ### Motivation fix python process with extra dependencies ``` java.io.IOException: Cannot run program “PYTHONPATH=${PYTHONPATH}:/Users/jerrypeng/workspace/incubator-pulsar/instances/deps”: error=2, No such file or directory at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048) ~[?:1.8.0_144] at org.apache.pulsar.functions.runtime.ProcessRuntime.startProcess(ProcessRuntime.java:291) [pulsar-functions-runtime.jar:2.3.0-SNAPSHOT] at org.apache.pulsar.functions.runtime.ProcessRuntime.start(ProcessRuntime.java:124) [pulsar-functions-runtime.jar:2.3.0-SNAPSHOT] at org.apache.pulsar.functions.runtime.RuntimeSpawner$1.run(RuntimeSpawner.java:94) [pulsar-functions-runtime.jar:2.3.0-SNAPSHOT] at java.util.TimerThread.mainLoop(Timer.java:555) [?:1.8.0_144] at java.util.TimerThread.run(Timer.java:505) [?:1.8.0_144] Caused by: java.io.IOException: error=2, No such file or directory at java.lang.UNIXProcess.forkAndExec(Native Method) ~[?:1.8.0_144] at java.lang.UNIXProcess.<init>(UNIXProcess.java:247) ~[?:1.8.0_144] at java.lang.ProcessImpl.start(ProcessImpl.java:134) ~[?:1.8.0_144] at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029) ~[?:1.8.0_144] ... 5 more ``` ### Modifications - set environment variables in process builder for process runtime - enable python function integration tests - add integration test for python function with extra dependencies ### Result python functions test passed and integration test for python function with extra deps is tested.
- Loading branch information
Showing
7 changed files
with
180 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
tests/docker-images/latest-version-image/python-examples/exclamation_lib.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,22 @@ | |||
#!/usr/bin/env python | |||
# | |||
# 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. | |||
# | |||
|
|||
def exclamation(input): | |||
return input + '!' |
31 changes: 31 additions & 0 deletions
31
tests/docker-images/latest-version-image/python-examples/exclamation_with_extra_deps.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,31 @@ | |||
#!/usr/bin/env python | |||
# | |||
# 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 pulsar import Function | |||
from exclamation_lib import exclamation | |||
|
|||
# The classic ExclamationFunction that appends an exclamation at the end | |||
# of the input | |||
class ExclamationFunction(Function): | |||
def __init__(self): | |||
pass | |||
|
|||
def process(self, input, context): | |||
return exclamation(input) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters