Search in sources :

Example 1 with RemoteEnvironment

use of org.apache.flink.api.java.RemoteEnvironment in project flink by apache.

the class CustomInputSplitProgram method main.

public static void main(String[] args) throws Exception {
    final String[] jarFile = (args[0].equals("")) ? null : new String[] { args[0] };
    final URL[] classpath = (args[1].equals("")) ? null : new URL[] { new URL(args[1]) };
    final String host = args[2];
    final int port = Integer.parseInt(args[3]);
    final int parallelism = Integer.parseInt(args[4]);
    RemoteEnvironment env = new RemoteEnvironment(host, port, null, jarFile, classpath);
    env.setParallelism(parallelism);
    env.getConfig().disableSysoutLogging();
    DataSet<Integer> data = env.createInput(new CustomInputFormat());
    data.map(new MapFunction<Integer, Tuple2<Integer, Double>>() {

        @Override
        public Tuple2<Integer, Double> map(Integer value) {
            return new Tuple2<Integer, Double>(value, value * 0.5);
        }
    }).output(new DiscardingOutputFormat<Tuple2<Integer, Double>>());
    env.execute();
}
Also used : RemoteEnvironment(org.apache.flink.api.java.RemoteEnvironment) MapFunction(org.apache.flink.api.common.functions.MapFunction) URL(java.net.URL) Tuple2(org.apache.flink.api.java.tuple.Tuple2)

Aggregations

URL (java.net.URL)1 MapFunction (org.apache.flink.api.common.functions.MapFunction)1 RemoteEnvironment (org.apache.flink.api.java.RemoteEnvironment)1 Tuple2 (org.apache.flink.api.java.tuple.Tuple2)1