Search code examples
apache-flinkflink-streaming

Flink webui when running from IDE


I am trying to see my job in the web ui.

I use createLocalEnvironmentWithWebUI, code is running well in IDE, but impossible to see my job in http://localhost:8081/#/overview

      val conf: Configuration = new Configuration()
      import org.apache.flink.configuration.ConfigConstants
      conf.setBoolean(ConfigConstants.LOCAL_START_WEBSERVER, true)
      val env =  StreamExecutionEnvironment.createLocalEnvironmentWithWebUI(conf)
      env.setStreamTimeCharacteristic(TimeCharacteristic.EventTime)


      val rides = env.addSource(
        new TaxiRideSource("nycTaxiRides.gz", 1,100))//60, 600))

      val filteredRides = rides
        .filter(r => GeoUtils.isInNYC(r.startLon, r.startLat) && GeoUtils.isInNYC(r.endLon, r.endLat))
        .map(r => (r.passengerCnt, 1))
        .keyBy(_._1)
        .window(TumblingTimeWindows.of(Time.seconds(5)))
        .sum(1)
        .map(r => (r._1.toString+"test", r._2))

      filteredRides.print()
      env.execute("Taxi Ride Cleansing")

Did I need to setup something else?


Solution

  • I was able to start the Flink webui from IntelliJ by adding flink-runtime-web to the dependencies for my project. I did this by adding this to my pom.xml file:

        <dependency>
            <groupId>org.apache.flink</groupId>
            <artifactId>flink-runtime-web</artifactId>
            <version>${flink.version}</version>
        </dependency>
    

    You also then need to create a local execution environment that includes the WebUI:

        Configuration conf = new Configuration();
        env = StreamExecutionEnvironment.createLocalEnvironmentWithWebUI(conf);