简体   繁体   English

Spark Streaming我们可以在执行程序上创建线程吗

[英]Spark streaming can we create a thread on executor

I have a question on spark streaming. 我对Spark Streaming有疑问。 In my spark streaming application, I have a code that runs on worker/executor as a task (inside foreachPartition() while processing a RDD). 在我的Spark Streaming应用程序中,我有一个代码作为任务运行在worker / executor上(在处理RDD时在foreachPartition()内部)。 I want to create a thread as part of this code that will run continuously on executor/worker from the time it is launched till executor is alive, listen to some external events and take some action based on that. 我想创建一个线程作为此代码的一部分,从启动执行器到执行器生效为止,它将在执行器/工作器上连续运行,听一些外部事件并据此采取一些措施。

Is this possible to do in spark streaming? 这可能在火花流中完成吗?

You could try to fit this into a custom receive. 您可以尝试将其放入自定义接收中。 You can find some details in Implementing a Custom Receiver . 您可以在实现自定义接收器中找到一些详细信息。 Otherwise it doesn't fit very well in the Spark streaming. 否则,它不太适合Spark流。

It is possible to start thread on the drive but I understand it is not what you want. 可以在驱动器上启动线程,但我知道这不是您想要的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我们可以在后台线程上创建CLLocation更新吗? - Can we create CLLocation updates on background thread? executor何时真正创建新线程 - when does executor really create new thread 我们如何在执行程序框架中模拟饥饿? - How can we simulate starvation in executor framework? 我们什么时候应该使用Java的Thread over Executor? - When should we use Java's Thread over Executor? 我们什么时候认为 Executor Service 中的工作线程是空闲的 - when do we consider a worker thread as free in Executor Service 我们可以为boost库中的每个线程创建单独的日志文件吗? - Can we create separate log files for each thread in boost library ExecutorService和OutOfMemoryError:使用Executor时无法创建新的本机线程 - ExecutorService and OutOfMemoryError: unable to create new native thread while using Executor OutOfMemoryError:使用执行程序时无法创建新的本机线程 - OutOfMemoryError: unable to create new native thread while using Executor 我们如何在UI线程中创建处理程序以将数据发送到另一个线程 - How can we create a handler in UI thread for sending data to another thread 如何使用线程池执行器重新实现它? - How can re-implement this using thread-pool executor?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM