bgeng777 commented on code in PR #306: URL: https://github.com/apache/flink-kubernetes-operator/pull/306#discussion_r917499478
########## examples/flink-python-example/Dockerfile: ########## @@ -0,0 +1,41 @@ +################################################################################ +# 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 flink:1.15.0 + + +RUN apt-get update -y && \ Review Comment: Good point. Fixed in df65337a15f05736a0e11034bfa114f84fd68fab ########## examples/flink-python-example/README.md: ########## @@ -0,0 +1,83 @@ +<!-- +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. +--> + +# Flink Kubernetes Operator Python Example + +## Overview + +This is an end-to-end example of running Flink Python jobs using the Flink Kubernetes Operator. + + +*What's in this example?* + + 1. Python script of a simple streaming job + 2. DockerFile to build custom image with pyflink and python demo + 3. Example YAML for submitting the python job using the operator + +## How does it work? + +Flink supports Python jobs in application mode by utilizing `org.apache.flink.client.python.PythonDriver` class as the +entry class. With the Flink Kubernetes Operator, we can reuse this class to run Python jobs as well. + +The class is packaged in flink-python_${scala_version}-${flink_version}.jar which is in the default Flink image. +So we do not need to create a new job jar. Instead, we just set `entryClass` of the job crd to +`org.apache.flink.client.python.PythonDriver`. After applying the job yaml, the launched job manager pod will run the `main()` +method of PythonDriver and parse arguments declared in the `args` field of the job crd. + +Note, in `args` field, users must either specify `-py` option or `-pym` option. Review Comment: Improved in df65337a15f05736a0e11034bfa114f84fd68fab -- 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. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
