简体   繁体   English

如何在python中为labview应用程序实现看门狗

[英]how to implement a watchdog for a labview application in python

I have a labview application(2013 32bit) that will run for long periods of time, and sometimes the entire labview app crashes for unknown reasons. 我有一个Labview应用程序(2013 32位),它将长时间运行,有时整个Labview应用程序由于未知原因而崩溃。 What I'd like to do is write an external python script which would act as the watchdog to this labview application. 我想做的是编写一个外部python脚本,它将充当此labview应用程序的看门狗。

So the labview app would periodically send a bit to the python script, and if the python script doesn't receive that then it will send me an alert. 因此,labview应用程序会定期向python脚本发送一些信息,如果python脚本未收到该信息,它将向我发送警报。

The question is how I would most easily achieve this one-way communication. 问题是我如何最轻松地实现这种单向沟通。 It looks like I could use dynamic data exchange , but that seems like overkill. 看来我可以使用动态数据交换 ,但这似乎有些过头。 A dumb way to do it would just be reading and writing to a text file. 一种愚蠢的方式只是读取和写入文本文件。 Neither side would actually have a direct form of communication. 双方实际上都没有直接的沟通形式。 But that doesn't seem completely reliable. 但这似乎并不完全可靠。

Are there any better and simpler alternatives? 有没有更好,更简单的替代方法?

If I was on your place I would just send local UDP packet once a 5 seconds. 如果我在您的位置,我将每5秒发送一次本地UDP数据包。

IF your architecture is modular you can send signals to your watchdog module from each module (to make sure every module is running). 如果您的体系结构是模块化的,则可以从每个模块向看门狗模块发送信号(以确保每个模块都在运行)。

The best way I think is to evaluate the problem and make your LabVIEW application running stable. 我认为最好的方法是评估问题,并使LabVIEW应用程序稳定运行。 For sure there is something in your code that crashes LabVIEW (ex. some queue gets full and your writer endpoint waits infinitely). 可以肯定的是,您的代码中有些东西会导致LabVIEW崩溃(例如,某些队列已满,并且您的编写器端点无限期地等待着)。

Why bother with IPC? 为什么要打扰IPC? Depending on the system you're running on there should be ways of monitoring running processes (eg. here ). 根据您所运行的系统,应该有监视正在运行的进程的方法(例如here )。 Your python script can check if your labview app is running. 您的python脚本可以检查您的labview应用程序是否正在运行。 You could even relaunch if it detects the desired process has died. 如果它检测到所需的进程已终止,您甚至可以重新启动。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM