Skip to content

Commit

Permalink
[FLINK-3195] [examples] Consolidate batch examples into one project, …
Browse files Browse the repository at this point in the history
…unify batch and streaming examples under on parent project
  • Loading branch information
StephanEwen authored and rmetzger committed Jan 14, 2016
1 parent 62938c1 commit d0e1d63
Show file tree
Hide file tree
Showing 102 changed files with 316 additions and 800 deletions.
18 changes: 9 additions & 9 deletions docs/apis/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,47 +46,47 @@ The command line can be used to

- Run example program with no arguments.

./bin/flink run ./examples/WordCount.jar
./bin/flink run ./examples/batch/WordCount.jar

- Run example program with arguments for input and result files

./bin/flink run ./examples/WordCount.jar \
./bin/flink run ./examples/batch/WordCount.jar \
file:https:///home/user/hamlet.txt file:https:///home/user/wordcount_out

- Run example program with parallelism 16 and arguments for input and result files

./bin/flink run -p 16 ./examples/WordCount.jar \
./bin/flink run -p 16 ./examples/batch/WordCount.jar \
file:https:///home/user/hamlet.txt file:https:///home/user/wordcount_out

- Run example program with flink log output disabled

./bin/flink run -q ./examples/WordCount.jar
./bin/flink run -q ./examples/batch/WordCount.jar

- Run example program in detached mode

./bin/flink run -d ./examples/WordCount.jar
./bin/flink run -d ./examples/batch/WordCount.jar

- Run example program on a specific JobManager:

./bin/flink run -m myJMHost:6123 \
./examples/WordCount.jar \
./examples/batch/WordCount.jar \
file:https:///home/user/hamlet.txt file:https:///home/user/wordcount_out

- Run example program with a specific class as an entry point:

./bin/flink run -c org.apache.flink.examples.java.wordcount.WordCount \
./examples/WordCount.jar \
./examples/batch/WordCount.jar \
file:https:///home/user/hamlet.txt file:https:///home/user/wordcount_out

- Run example program using a [per-job YARN cluster]({{site.baseurl}}/setup/yarn_setup.html#run-a-single-flink-job-on-hadoop-yarn) with 2 TaskManagers:

./bin/flink run -m yarn-cluster -yn 2 \
./examples/WordCount.jar \
./examples/batch/WordCount.jar \
hdfs:https:///user/hamlet.txt hdfs:https:///user/wordcount_out

- Display the optimized execution plan for the WordCount example program as JSON:

./bin/flink info ./examples/WordCount.jar \
./bin/flink info ./examples/batch/WordCount.jar \
file:https:///home/user/hamlet.txt file:https:///home/user/wordcount_out

- List scheduled and running jobs (including their JobIDs):
Expand Down
4 changes: 2 additions & 2 deletions docs/apis/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ Each binary release of Flink contains an `examples` directory with jar files for
To run the WordCount example, issue the following command:

~~~bash
./bin/flink run ./examples/WordCount.jar
./bin/flink run ./examples/batch/WordCount.jar
~~~

The other examples can be started in a similar way.

Note that many examples run without passing any arguments for them, by using build-in data. To run WordCount with real data, you have to pass the path to the data:

~~~bash
./bin/flink run ./examples/WordCount.jar /path/to/some/text/data /path/to/result
./bin/flink run ./examples/batch/WordCount.jar /path/to/some/text/data /path/to/result
~~~

Note that non-local file systems require a schema prefix, such as `hdfs:https://`.
Expand Down
2 changes: 1 addition & 1 deletion docs/setup/gce_setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ To bring up the Flink cluster on Google Compute Engine, execute:

./bdutil shell
cd /home/hadoop/flink-install/bin
./flink run ../examples/WordCount.jar gs:https://dataflow-samples/shakespeare/othello.txt gs:https://<bucket_name>/output
./flink run ../examples/batch/WordCount.jar gs:https://dataflow-samples/shakespeare/othello.txt gs:https://<bucket_name>/output

## Shut down your cluster

Expand Down
6 changes: 3 additions & 3 deletions docs/setup/yarn_setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Once the session has been started, you can submit jobs to the cluster using the
curl -O <flink_hadoop2_download_url>
tar xvzf flink-{{ site.version }}-bin-hadoop2.tgz
cd flink-{{ site.version }}/
./bin/flink run -m yarn-cluster -yn 4 -yjm 1024 -ytm 4096 ./examples/WordCount.jar
./bin/flink run -m yarn-cluster -yn 4 -yjm 1024 -ytm 4096 ./examples/batch/WordCount.jar
~~~

## Apache Flink on Hadoop YARN using a YARN Session
Expand Down Expand Up @@ -179,7 +179,7 @@ Use the *run* action to submit a job to YARN. The client is able to determine th
~~~bash
wget -O LICENSE-2.0.txt http:https://www.apache.org/licenses/LICENSE-2.0.txt
hadoop fs -copyFromLocal LICENSE-2.0.txt hdfs:https:/// ...
./bin/flink run ./examples/WordCount.jar \
./bin/flink run ./examples/batch/WordCount.jar \
hdfs:https:///..../LICENSE-2.0.txt hdfs:https:///.../wordcount-result.txt
~~~

Expand All @@ -205,7 +205,7 @@ Please note that the client then expects the `-yn` value to be set (number of Ta
***Example:***

~~~bash
./bin/flink run -m yarn-cluster -yn 2 ./examples/WordCount.jar
./bin/flink run -m yarn-cluster -yn 2 ./examples/batch/WordCount.jar
~~~

The command line options of the YARN session are also available with the `./bin/flink` tool.
Expand Down
6 changes: 3 additions & 3 deletions flink-contrib/flink-storm-examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ under the License.

<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-java-examples</artifactId>
<artifactId>flink-examples-batch</artifactId>
<version>${project.version}</version>
</dependency>

Expand Down Expand Up @@ -73,7 +73,7 @@ under the License.

<build>
<plugins>
<!-- get default data from flink-java-examples package -->
<!-- get default data from flink-example-batch package -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
Expand All @@ -89,7 +89,7 @@ under the License.
<artifactItems>
<artifactItem>
<groupId>org.apache.flink</groupId>
<artifactId>flink-java-examples</artifactId>
<artifactId>flink-examples-batch</artifactId>
<version>${project.version}</version>
<type>jar</type>
<overWrite>false</overWrite>
Expand Down
8 changes: 1 addition & 7 deletions flink-dist/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,7 @@ under the License.

<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-java-examples</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-scala-examples</artifactId>
<artifactId>flink-examples-batch</artifactId>
<version>${project.version}</version>
</dependency>

Expand Down
32 changes: 21 additions & 11 deletions flink-dist/src/main/assemblies/bin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ under the License.
<!-- copy *.txt files -->
<fileSet>
<directory>src/main/flink-bin/</directory>
<outputDirectory></outputDirectory>
<outputDirectory/>
<fileMode>0644</fileMode>
<includes>
<include>*.txt</include>
Expand All @@ -113,7 +113,7 @@ under the License.
<!-- copy LICENSE/NOTICE files -->
<fileSet>
<directory>../</directory>
<outputDirectory></outputDirectory>
<outputDirectory/>
<fileMode>0644</fileMode>
<includes>
<include>LICENSE*</include>
Expand Down Expand Up @@ -150,21 +150,31 @@ under the License.
</excludes>
</fileSet>

<!-- copy jar files of java examples -->
<!-- copy jar files of the batch examples -->
<fileSet>
<directory>../flink-examples/flink-java-examples/target</directory>
<outputDirectory>examples</outputDirectory>
<directory>../flink-examples/flink-examples-batch/target</directory>
<outputDirectory>examples/batch</outputDirectory>
<fileMode>0644</fileMode>
<includes>
<include>*.jar</include>
</includes>
<excludes>
<exclude>flink-java-examples*-${project.version}.jar</exclude>
<exclude>original-flink-java-examples*-${project.version}.jar</exclude>
<exclude>flink-java-examples*-${project.version}-sources.jar</exclude>
<exclude>flink-java-examples*-${project.version}-tests.jar</exclude>
<exclude>flink-java-examples*-${project.version}-javadoc.jar</exclude>
<exclude>flink-java-examples*-${project.version}-*.jar</exclude>
<exclude>flink-examples-batch*.jar</exclude>
<exclude>original-flink-examples-batch*.jar</exclude>
</excludes>
</fileSet>

<!-- copy jar files of the streaming examples -->
<fileSet>
<directory>../flink-examples/flink-examples-streaming/target</directory>
<outputDirectory>examples/streaming</outputDirectory>
<fileMode>0644</fileMode>
<includes>
<include>*.jar</include>
</includes>
<excludes>
<exclude>flink-examples-streaming*.jar</exclude>
<exclude>original-flink-examples-streaming*.jar</exclude>
</excludes>
</fileSet>

Expand Down
Loading

0 comments on commit d0e1d63

Please sign in to comment.