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

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

                Author: ASF GitHub Bot
            Created on: 11/Oct/19 22:44
            Start Date: 11/Oct/19 22:44
    Worklog Time Spent: 10m 
      Work Description: ibzib commented on pull request #9775: [BEAM-8372] Job 
server submitting UberJars directly to Flink Runner.
URL: https://github.com/apache/beam/pull/9775#discussion_r334156913
 
 

 ##########
 File path: 
sdks/python/apache_beam/runners/portability/flink_uber_jar_job_server.py
 ##########
 @@ -0,0 +1,233 @@
+#
+# 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.
+#
+
+"""A job server submitting portable pipelines as uber jars to Flink."""
+
+from __future__ import absolute_import
+from __future__ import print_function
+
+import logging
+import os
+import shutil
+import tempfile
+import time
+import zipfile
+
+from google.protobuf import json_format
+import grpc
+import requests
+from concurrent import futures
+
+from apache_beam.portability.api import beam_artifact_api_pb2_grpc
+from apache_beam.portability.api import beam_job_api_pb2
+from apache_beam.portability.api import endpoints_pb2
+from apache_beam.runners.portability import abstract_job_service
+from apache_beam.runners.portability import artifact_service
+from apache_beam.runners.portability import job_server
+
+
+class FlinkUberJarJobServer(abstract_job_service.AbstractJobServiceServicer):
+
+  def __init__(self, master_url, executable_jar=None):
+    super(FlinkUberJarJobServer, self).__init__()
+    self._master_url = master_url
+    self._executable_jar = executable_jar
+    self._temp_dir = tempfile.mkdtemp(prefix='apache-beam-flink')
+
+  def start(self):
+    return self
+
+  def stop(self):
+    pass
+
+  def executable_jar(self):
+    return self._executable_jar or job_server.JavaJarJobServer.local_jar(
+        job_server.JavaJarJobServer.path_to_beam_jar(
+            'runners:flink:%s:job-server:shadowJar' % self.flink_version()))
+
+  def flink_version(self):
+    full_version = requests.get(
+        '%s/v1/config' % self._master_url).json()['flink-version']
+    # Only return up to minor version.
+    return '.'.join(full_version.split('.')[:2])
+
+  def create_beam_job(self, job_id, job_name, pipeline, options):
+    return FlinkBeamJob(
+        self._master_url,
+        self.executable_jar(),
+        job_id,
+        job_name,
+        pipeline,
+        options)
+
+
+class FlinkBeamJob(abstract_job_service.AbstractBeamJob):
+
+  # These must agree with those defined in PortablePipelineJarUtils.java.
 
 Review comment:
   FYI, I have an open PR #9752 that would change the jar structure.
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 327105)
    Time Spent: 0.5h  (was: 20m)

> Allow submission of Flink UberJar directly to flink cluster.
> ------------------------------------------------------------
>
>                 Key: BEAM-8372
>                 URL: https://issues.apache.org/jira/browse/BEAM-8372
>             Project: Beam
>          Issue Type: New Feature
>          Components: sdk-py-core
>            Reporter: Robert Bradshaw
>            Assignee: Robert Bradshaw
>            Priority: Major
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>




--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to