spark streaming 5: InputDStream
/** * This is the abstract base class . This class provides methods * start() and stop() which is called by Spark Streaming system to . * Input streams that can For example, * FileInputDStream, a subclass of InputDStream, monitors a HDFS directory from the driver for * new files and generates RDDs with the new files. . * * @param ssc_ Streaming context that will execute this input stream */abstract class T@transient extends Tprivatevar lastValidTimenull graphthis
/** * Abstract class for defining any [[org.apache.spark.streaming.dstream.InputDStream]] * that has to start a receiver on worker nodes to receive external data. * * @param ssc_ Streaming context that will execute this input stream * @tparam T Class type of the object of this stream */abstract class T@transient extends T/** Keeps all received blocks information */ private lazy val new , /** This is an unique identifier for the network input stream. */ val id
/** * Gets the receiver object that will be sent to the worker nodes * to receive data. This method needs to defined by any specific implementation * of a NetworkInputDStream. */def getReceiver(): Receiver[T]
/** Ask ReceiverInputTracker for received data blocks and generates RDDs with them. */override def compute(validTime: Time): Option[RDD[T]] = {// If this is called for any time before the start time of the context, // then this returns an empty RDD. This may happen when recovering from a // master failure if (validTime >= graph.startTime) {val blockInfo = ssc.scheduler.receiverTracker.getReceivedBlockInfo(id)receivedBlockInfo(validTime) = blockInfoval blockIds = blockInfo.map(_.blockId.asInstanceOf[BlockId])Some(new BlockRDD[T](ssc.sc, blockIds)) } else {Some(new BlockRDD[T](ssc.sc, Array[BlockId]())) }}
转载于:https://www.cnblogs.com/zwCHAN/p/4275348.html
spark streaming 5: InputDStream相关推荐
- Spark Streaming笔记整理(二):案例、SSC、数据源与自定义Receiver
[TOC] 实时WordCount案例 主要是监听网络端口中的数据,并实时进行wc的计算. Java版 测试代码如下: package cn.xpleaf.bigdata.spark.java.str ...
- 大数据技术之Spark Streaming概述
前言 数据处理延迟的长短 实时数据处理:毫秒级别 离线数据处理:小时 or 天 数据处理的方式 流式(streaming)数据处理 批量(batch)数据处理 spark Streaming也是基于s ...
- Spark Streaming 常见的输入数据源(以WordCount计算为例)
SparkStreaming中的数据抽象叫做DStream.DStream是抽象类,它把连续的数据流拆成很多的小RDD数据块, 这叫做"微批次", spark的流式处理, 都是 ...
- Spark Streaming揭秘 Day9 从Receiver的设计到Spark框架的扩展
Spark Streaming揭秘 Day9 从Receiver的设计到Spark框架的扩展 Receiver是SparkStreaming的输入数据来源,从对Receiver整个生命周期的设计,我们 ...
- Spark Streaming Backpressure分析
转载自:http://www.cnblogs.com/barrenlake/p/5349949.html# 1.为什么引入Backpressure 默认情况下,Spark Streaming通过Rec ...
- string 中的offset_Kafka+Spark Streaming管理offset的两种方法
Kafka配合Spark Streaming是大数据领域常见的黄金搭档之一,主要是用于数据实时入库或分析. 为了应对可能出现的引起Streaming程序崩溃的异常情况,我们一般都需要手动管理好Kaf ...
- Spark Streaming 实战案例(一)
本节主要内容 本节部分内容来自官方文档:http://spark.apache.org/docs/latest/streaming-programming-guide.html#mllib-opera ...
- Spark Streaming 实现思路与模块概述
Spark Streaming 实现思路与模块概述 [酷玩 Spark] Spark Streaming 源码解析系列 ,返回目录请 猛戳这里 「腾讯·广点通」技术团队荣誉出品 本文内容适用范围: 2 ...
- spark streaming 的 Job创建、调度、提交
2019独角兽企业重金招聘Python工程师标准>>> 上文已经从源码分析了Receiver接收的数据交由BlockManager管理,整个数据接收流都已经运转起来了,那么让我们回到 ...
最新文章
- JAVA中jsp怎么接收参数_如何使用JSP从URL获取参数
- java难点解析(七)-抽象类
- Python之Pandas:pandas.DataFrame.to_csv函数的简介、具体案例、使用方法详细攻略
- STM32 CJSON解析说明
- mq服务器与客户端消息同步,使用 ActiveMQ 实现JMS 异步调用
- axios 注册拦截器 cdn引用_PicGo+jsDelivr+GitHub搭建免费cdn加速的图床
- ThinkPHP对Cookie的支持
- jemter的竞品分析
- OPC DA通讯 KEP6.4 DCOM 配置脚本
- 不会使用Spring的配置文件,赶紧把这个甩给他
- Redmi K50评测:顶级2K屏加持 无愧全价位焊门员
- 为什么说“不要教你的孩子学编程”?
- DP练习(初级):ZigZag
- tuned-adm性能优化工具详解
- linux 7启动xserver,linux7.x下配置nginx开机自启动
- PAT-A1020:Tree Traversal(二叉树的重建及其中序、后序遍历)
- 圈圈教你玩USB(第二版) 笔记
- 在c语言中字母是几个字节的,在c语言中int占几个字节
- 学习java之前应该先了解哪些知识?
- 常用的一些vba代码