[ 
https://issues.apache.org/jira/browse/BEAM-5978?focusedWorklogId=171059&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-171059
 ]

ASF GitHub Bot logged work on BEAM-5978:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 30/Nov/18 11:16
            Start Date: 30/Nov/18 11:16
    Worklog Time Spent: 10m 
      Work Description: asfgit closed pull request #6954: [BEAM-5978] Adding 
libltdl7 to flink job server docker and correctly picking the docker executable.
URL: https://github.com/apache/beam/pull/6954
 
 
   

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..8498deba8933 100644
--- a/sdks/python/apache_beam/runners/portability/job_server.py
+++ b/sdks/python/apache_beam/runners/portability/job_server.py
@@ -21,9 +21,11 @@
 import logging
 import os
 import signal
+import socket
 import sys
 import time
 from subprocess import Popen
+from subprocess import check_output
 from threading import Lock
 
 
@@ -33,8 +35,8 @@ class DockerizedJobServer(object):
   """
 
   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 +51,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 +107,14 @@ 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
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: 171059)
    Time Spent: 2h 50m  (was: 2h 40m)

> portableWordCount gradle task not working
> -----------------------------------------
>
>                 Key: BEAM-5978
>                 URL: https://issues.apache.org/jira/browse/BEAM-5978
>             Project: Beam
>          Issue Type: Bug
>          Components: examples-python
>            Reporter: Ankur Goenka
>            Assignee: Ankur Goenka
>            Priority: Major
>          Time Spent: 2h 50m
>  Remaining Estimate: 0h
>
> A few issues with portableWordCount gradle task when running with jobserver 
> docker image
>  # Jobserver docker image docker mount fails on linux.
>  # Docker can not write read and write to local file system.
>  # Docker from jobserver docker container requires libltdl7 lib on linux.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to