[
https://issues.apache.org/jira/browse/BEAM-6146?focusedWorklogId=171062&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-171062
]
ASF GitHub Bot logged work on BEAM-6146:
----------------------------------------
Author: ASF GitHub Bot
Created on: 30/Nov/18 11:18
Start Date: 30/Nov/18 11:18
Worklog Time Spent: 10m
Work Description: mxm closed pull request #7157: [BEAM-6146] WIP Portable
Python Precommit test
URL: https://github.com/apache/beam/pull/7157
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/.test-infra/jenkins/job_PreCommit_Portable_Python.groovy
b/.test-infra/jenkins/job_PreCommit_Portable_Python.groovy
new file mode 100644
index 000000000000..1f268981c2f9
--- /dev/null
+++ b/.test-infra/jenkins/job_PreCommit_Portable_Python.groovy
@@ -0,0 +1,32 @@
+/*
+ * 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.
+ */
+
+import PrecommitJobBuilder
+
+PrecommitJobBuilder builder = new PrecommitJobBuilder(
+ scope: this,
+ nameBase: 'Portable_Python',
+ gradleTask: ':portablePythonPreCommit',
+ triggerPathPatterns: [
+ '^model/.*$',
+ '^runners/.*$',
+ '^sdks/python/.*$',
+ '^release/.*$',
+ ]
+)
+builder.build {}
diff --git a/build.gradle b/build.gradle
index 269da86f8656..a74817f70e8d 100644
--- a/build.gradle
+++ b/build.gradle
@@ -246,6 +246,10 @@ task pythonPostCommit() {
dependsOn ":beam-sdks-python:postCommit"
}
+task portablePythonPreCommit() {
+ dependsOn ":beam-sdks-python:portablePreCommit"
+}
+
task websitePreCommit() {
dependsOn ":beam-website:preCommit"
}
diff --git a/runners/flink/job-server-container/Dockerfile
b/runners/flink/job-server-container/Dockerfile
index 569c2ab04066..51f0e0f74cae 100644
--- a/runners/flink/job-server-container/Dockerfile
+++ b/runners/flink/job-server-container/Dockerfile
@@ -19,6 +19,8 @@
FROM openjdk:8
MAINTAINER "Apache Beam <[email protected]>"
+RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y
libltdl7
+
ADD target/beam-runners-flink-job-server.jar /opt/apache/beam/jars/
ADD target/flink-job-server.sh /opt/apache/beam/
diff --git a/sdks/python/apache_beam/runners/portability/job_server.py
b/sdks/python/apache_beam/runners/portability/job_server.py
index 25b8666121a2..61d9d933fe05 100644
--- a/sdks/python/apache_beam/runners/portability/job_server.py
+++ b/sdks/python/apache_beam/runners/portability/job_server.py
@@ -21,20 +21,23 @@
import logging
import os
import signal
+import socket
+from subprocess import check_output
import sys
import time
from subprocess import Popen
from threading import Lock
+
class DockerizedJobServer(object):
"""
Spins up the JobServer in a docker container for local execution
"""
def __init__(self, job_host="localhost",
- job_port=8099,
- artifact_port=8098,
+ job_port=None,
+ artifact_port=None,
harness_port_range=(8100, 8200),
max_connection_retries=5):
self.job_host = job_host
@@ -49,12 +52,18 @@ def start(self):
# TODO This is hardcoded to Flink at the moment but should be changed
job_server_image_name = os.environ['USER'] + \
"-docker-apache.bintray.io/beam/flink-job-server:latest"
+ docker_path = check_output(['which', 'docker']).strip()
cmd = ["docker", "run",
# We mount the docker binary and socket to be able to spin up
# "sibling" containers for the SDK harness.
- "-v", "/usr/local/bin/docker:/bin/docker",
+ "-v", ':'.join([docker_path, "/bin/docker"]),
"-v", "/var/run/docker.sock:/var/run/docker.sock"]
- args = ["--job-host", self.job_host, "--job-port", str(self.job_port)]
+ self.job_port = DockerizedJobServer._pick_port(self.job_port)
+ # artifact_port 0 suggest to pick a dynamic port.
+ self.artifact_port = self.artifact_port if self.artifact_port else 0
+ args = ['--job-host', self.job_host,
+ '--job-port', str(self.job_port),
+ '--artifact-port', str(self.artifact_port)]
if sys.platform == "darwin":
# Docker-for-Mac doesn't support host networking, so we need to explictly
@@ -99,3 +108,15 @@ def stop(self):
time.sleep(1)
if self.docker_process.poll is None:
self.docker_process.kill()
+
+
+ @staticmethod
+ def _pick_port(port):
+ if port:
+ return port
+ """Not perfect, but we have to provide a port to the subprocess."""
+ s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+ s.bind(('localhost', 0))
+ _, port = s.getsockname()
+ s.close()
+ return port
\ No newline at end of file
diff --git a/sdks/python/build.gradle b/sdks/python/build.gradle
index d26e292668de..aba3904a1b6d 100644
--- a/sdks/python/build.gradle
+++ b/sdks/python/build.gradle
@@ -161,6 +161,12 @@ task preCommit() {
dependsOn "lint"
}
+task portablePreCommit() {
+ dependsOn ':beam-runners-flink_2.11-job-server-container:docker'
+ dependsOn ':beam-sdks-python-container:docker'
+ dependsOn 'portableWordCount'
+}
+
/*************************************************************************************************/
// E2E integration testing and validates runner testing
@@ -267,6 +273,7 @@ task portableWordCount(dependsOn: 'installGcpTest') {
"--input=/etc/profile",
"--output=/tmp/py-wordcount-direct",
"--runner=PortableRunner",
+ "--experiments=worker_threads=100",
]
if (project.hasProperty("streaming"))
options += ["--streaming"]
@@ -282,6 +289,9 @@ task portableWordCount(dependsOn: 'installGcpTest') {
}
}
}
+// Make sure that the job server is built before the portableWordCount is
executed.
+portableWordCount.mustRunAfter
':beam-runners-flink_2.11-job-server-container:docker'
+portableWordCount.mustRunAfter ':beam-sdks-python-container:docker'
// Run single or a set of integration tests with provided test options and
pipeline options.
task integrationTest(dependsOn: ['installGcpTest', 'sdist']) {
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 171062)
Time Spent: 3h 10m (was: 3h)
> Portable Flink End to end precommit test
> ----------------------------------------
>
> Key: BEAM-6146
> URL: https://issues.apache.org/jira/browse/BEAM-6146
> Project: Beam
> Issue Type: Bug
> Components: runner-flink
> Reporter: Ankur Goenka
> Assignee: Ankur Goenka
> Priority: Major
> Fix For: 2.10.0
>
> Time Spent: 3h 10m
> Remaining Estimate: 0h
>
> Create an end to end wordcount based pipeline test executed on precommit.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)