206、Spark 2.0之Structured Streaming:管理streaming query

管理streaming query

val query = df.writeStream.format("console").start()   // get the query object
query.id          // get the unique identifier of the running query
query.name        // get the name of the auto-generated or user-specified name
query.explain()   // print detailed explanations of the query
query.stop()      // stop the query 
query.awaitTermination()   // block until query is terminated, with stop() or with error
query.exception()    // the exception if the query has been terminated with error
query.sourceStatus()  // progress information about data has been read from the input sources
query.sinkStatus()   // progress information about data written to the output sink


val spark: SparkSession = ...
spark.streams.active    // get the list of currently active streaming queries
spark.streams.get(id)   // get a query object by its unique id
spark.streams.awaitAnyTermination()   // block until any one of them terminates
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容