def run(self, flink):
        env = flink.get_execution_environment()
        env.create_python_source(Generator(num_iters=constants.NUM_ITERATIONS_IN_TEST)) \
            .key_by(Selector()) \
            .time_window(seconds(1)) \
            .apply(WindowSum()) \
            .output()

        env.execute()
示例#2
0
    def run(self):
        env = self._get_execution_environment()
        env.add_source(Generator(num_iters=100*constants.NUM_ITERATIONS_IN_TEST)) \
            .key_by(Selector()) \
            .time_window(seconds(1)) \
            .apply(WindowSum()) \
            .print()

        env.execute(True)
    def run(self):
        env = self._get_execution_environment()
        env.add_source(Generator(num_iters=constants.NUM_ITERATIONS_IN_TEST)) \
            .flat_map(Tokenizer()) \
            .key_by(Selector()) \
            .time_window(seconds(1)) \
            .reduce(Sum()) \
            .print()

        env.execute(True)
示例#4
0
    def run(self, flink):
        env = flink.get_execution_environment()
        env.enable_checkpointing(1000, CheckpointingMode.AT_LEAST_ONCE) \
            .create_python_source(Generator(num_iters=constants.NUM_ITERATIONS_IN_TEST)) \
            .flat_map(Tokenizer()) \
            .key_by(Selector()) \
            .time_window(seconds(1)) \
            .reduce(Sum()) \
            .output()

        env.execute()
示例#5
0
    def run(self):
        env = self._get_execution_environment()
        env.enable_checkpointing(1000, CheckpointingMode.AT_LEAST_ONCE) \
            .add_source(Generator(num_iters=constants.NUM_ITERATIONS_IN_TEST)) \
            .flat_map(Tokenizer()) \
            .key_by(Selector()) \
            .time_window(seconds(1)) \
            .reduce(Sum()) \
            .print()

        result = env.execute("MyJob", True)
        print("Job completed, job_id={}".format(str(result.jobID)))
示例#6
0
    def run(self, flink):
        f_port = utils.gen_free_port()
        SocketStringGenerator(host='', port=f_port, msg='Hello World', num_iters=constants.NUM_ITERATIONS_IN_TEST).start()
        time.sleep(0.5)

        env = flink.get_execution_environment()
        env.socket_text_stream('localhost', f_port) \
            .flat_map(Tokenizer()) \
            .key_by(Selector()) \
            .time_window(seconds(1)) \
            .reduce(Sum()) \
            .output()

        env.execute()
    def run(self):
        f_port = utils.gen_free_port()
        SocketStringGenerator(host='', port=f_port, msg='Hello World', num_iters=constants.NUM_ITERATIONS_IN_TEST).start()
        time.sleep(0.5)

        env = self._get_execution_environment()
        env.socket_text_stream('localhost', f_port) \
            .flat_map(Tokenizer()) \
            .key_by(Selector()) \
            .time_window(seconds(1)) \
            .reduce(Sum()) \
            .print()

        env.execute(True)