当前位置: 首页 > news >正文

重庆永川网站建设价格广东云浮疫情最新情况

重庆永川网站建设价格,广东云浮疫情最新情况,校园服装网站建设演示文稿,公益网站建设那家好文章目录 背景主要步骤代码 背景 通常使用flink 提供的高级算子来编写flink 任务,对底层不是很了解,尤其是如何生成作业图的细节 下面通过构造一个有向无环图,来实际看一下 主要步骤 1.增加source 2.增加operator 3. 增加一条边&#xff0…

文章目录

      • 背景
      • 主要步骤
      • 代码

背景

通常使用flink 提供的高级算子来编写flink 任务,对底层不是很了解,尤其是如何生成作业图的细节
下面通过构造一个有向无环图,来实际看一下

主要步骤

1.增加source
2.增加operator
3. 增加一条边,连接source和operator
4. 增加sink
5. 增加一条边,连接operator和sink

代码

 // Step 1: Create basic configurationsConfiguration configuration = new Configuration();ExecutionConfig executionConfig = new ExecutionConfig();CheckpointConfig checkpointConfig = new CheckpointConfig();SavepointRestoreSettings savepointRestoreSettings = SavepointRestoreSettings.none();// Step 2: Create a new StreamGraph instanceStreamGraph streamGraph = new StreamGraph(configuration, executionConfig, checkpointConfig, savepointRestoreSettings);// Step 3: Add a source operatorGeneratorFunction<Long, String> generatorFunction = index -> "Number: " + index;DataGeneratorSource<String> source = new DataGeneratorSource<>(generatorFunction, Long.MAX_VALUE, RateLimiterStrategy.perSecond(1), Types.STRING);SourceOperatorFactory<String> sourceOperatorFactory = new SourceOperatorFactory<>(source, WatermarkStrategy.noWatermarks());streamGraph.addSource(1, "sourceNode", "sourceDescription", sourceOperatorFactory, TypeInformation.of(String.class), TypeInformation.of(String.class), "sourceSlot");// Step 4: Add a map operator to transform the dataStreamMap<String, String> mapOperator = new StreamMap<>(new MapFunction<String, String>() {@Overridepublic String map(String value) throws Exception {return value;}});SimpleOperatorFactory<String> mapOperatorFactory = SimpleOperatorFactory.of(mapOperator);streamGraph.addOperator(2, "mapNode", "mapDescription", mapOperatorFactory, TypeInformation.of(String.class), TypeInformation.of(String.class), "mapSlot");// Step 5: Connect source and map operatorstreamGraph.addEdge(1, 2, 0);// Step 6: Add a sink operator to consume the dataStreamMap<String, String> sinkOperator = new StreamMap<>(new MapFunction<String, String>() {@Overridepublic String map(String value) throws Exception {System.out.println(value);return value;}});SimpleOperatorFactory<String> sinkOperatorFactory = SimpleOperatorFactory.of(sinkOperator);streamGraph.addSink(3, "sinkNode", "sinkDescription", sinkOperatorFactory, TypeInformation.of(String.class), TypeInformation.of(String.class), "sinkSlot");// Step 7: Connect map and sink operatorstreamGraph.addEdge(2, 3, 0);streamGraph.setTimeCharacteristic(TimeCharacteristic.ProcessingTime);streamGraph.setMaxParallelism(1,1);streamGraph.setMaxParallelism(2,1);streamGraph.setMaxParallelism(3,1);streamGraph.setGlobalStreamExchangeMode(GlobalStreamExchangeMode.ALL_EDGES_PIPELINED);// Step 8: Convert StreamGraph to JobGraphJobGraph jobGraph = streamGraph.getJobGraph();// Step 9: Set up a MiniCluster for local executionMiniClusterConfiguration miniClusterConfig = new MiniClusterConfiguration.Builder().setNumTaskManagers(10).setNumSlotsPerTaskManager(10).build();MiniCluster miniCluster = new MiniCluster(miniClusterConfig);// Step 10: Start the MiniClusterminiCluster.start();// Step 11: Submit the job to the MiniClusterJobExecutionResult result = miniCluster.executeJobBlocking(jobGraph);System.out.println("Job completed with result: " + result);// Step 12: Stop the MiniClusterminiCluster.close();
http://www.hrbkazy.com/news/16039.html

相关文章:

  • 做计算机题的网站链接优化方法
  • 360未经证实的网站如何做百度世界排名
  • 网站建设那家公司好遵义网站seo
  • 如何查看网站页面大小快速排名工具免费查询
  • 范县网站建设公司站长统计 网站统计
  • 金湖县网站建设怎么上百度搜索
  • 高校网络网站建设意义及措施湖南seo网站开发
  • 兰州做网站价格网站流量统计分析报告
  • 泉州网站建设武汉seo网站推广培训
  • 盱眙在仕德伟做网站的有几家百度最新财报
  • 网站开发图标下载抖音关键词排名
  • 荥阳网站推广seo引擎优化怎么做
  • 微信网站开发制作公司搜索引擎营销有哪些
  • 邯郸做移动网站的公司快速网络推广
  • 做天猫转让网站友情链接交换方式有哪些
  • 商会网站制作武汉电脑培训学校有哪些
  • WordPress小说漫画主题国外独立站seo外链平台
  • 惠州做网站的公司有哪些seo人员培训
  • 创意网站建设设计seo整站优化推广
  • 商贸信息网站互联网项目推广
  • 网站做加QQ群链接百度网站禁止访问怎么解除
  • 个人网站备案网址导航制作网页用什么软件
  • 重庆网站seo公司哪家好海南seo代理加盟供应商
  • 中国建设网站培训通知想建立自己的网站怎么建立
  • 如何删除网站的信息吗bt种子磁力搜索
  • 深圳 手机网站建设免费的网络推广渠道
  • 怎么用flash做游戏下载网站快速排名刷
  • 怎样看出一个网站是那个公司做的nba最新交易一览表
  • 做1688网站运营工资怎么样福州网站排名推广
  • 唐山如何做百度的网站品牌宣传策划公司