bugfixes im PipeLogwriter()

logapp Datei wird von PipeLogwriter vollständig verwaltet
This commit is contained in:
2017-03-22 12:24:12 +01:00
parent b3c7544daa
commit 76e423410f
8 changed files with 315 additions and 641 deletions

View File

@@ -4,3 +4,4 @@ test/*
.*
build/*
*.pyc
deb/*

View File

@@ -12,7 +12,7 @@ Main functions of our program.
<h3 style="background-color:#FFFFFF;color:#FF0000">
Global Attributes</h3>
<table>
<tr><td>forked</td></tr><tr><td>globalconffile</td></tr><tr><td>logapp</td></tr><tr><td>logger</td></tr><tr><td>logplc</td></tr><tr><td>pargs</td></tr>
<tr><td>forked</td></tr><tr><td>globalconffile</td></tr><tr><td>logapp</td></tr><tr><td>logger</td></tr><tr><td>logplc</td></tr><tr><td>pargs</td></tr><tr><td>startdir</td></tr>
</table>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Classes</h3>

View File

@@ -42,7 +42,7 @@ Classes</h3>
<td>Ermoeglicht den Zugriff auf die Logdateien.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#PipeLogwriter">PipeLogwriter</a></td>
<td></td>
<td>File PIPE fuer das Schreiben des APP Log.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiPlc">RevPiPlc</a></td>
<td>Verwaltet das PLC Python Programm.</td>
@@ -171,7 +171,16 @@ str() mit Logdaten
<hr /><hr />
<a NAME="PipeLogwriter" ID="PipeLogwriter"></a>
<h2 style="background-color:#FFFFFF;color:#0000FF">PipeLogwriter</h2>
<p>
File PIPE fuer das Schreiben des APP Log.
</p><p>
Spezieller LogFile-Handler fuer die Ausgabe des subprocess fuer das Python
PLC Programm. Die Ausgabe kann nicht auf einen neuen FileHandler
umgeschrieben werden. Dadurch waere es nicht moeglich nach einem logrotate
die neue Datei zu verwenden. Ueber die PIPE wird dies umgangen.
</p><p>
</p>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Derived from</h3>
Thread
@@ -190,13 +199,25 @@ Methods</h3>
<table>
<tr>
<td><a style="color:#0000FF" href="#PipeLogwriter.__init__">PipeLogwriter</a></td>
<td>Instantiiert PipeLogwriter-Klasse.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#PipeLogwriter.__del__">__del__</a></td>
<td></td>
</tr><tr>
<td><a style="color:#0000FF" href="#PipeLogwriter._configurefh">_configurefh</a></td>
<td>Konfiguriert den FileHandler fuer Ausgaben der PLCAPP.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#PipeLogwriter.logline">logline</a></td>
<td>Schreibt eine Zeile in die Logdatei oder stdout.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#PipeLogwriter.newlogfile">newlogfile</a></td>
<td>Konfiguriert den FileHandler auf eine neue Logdatei.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#PipeLogwriter.run">run</a></td>
<td></td>
<td>Prueft auf neue Logzeilen und schreibt diese.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#PipeLogwriter.stop">stop</a></td>
<td></td>
<td>Beendetden Thread und die FileHandler werden geschlossen.</td>
</tr>
</table>
<h3 style="background-color:#FFFFFF;color:#FF0000">
@@ -207,16 +228,59 @@ Static Methods</h3>
<a NAME="PipeLogwriter.__init__" ID="PipeLogwriter.__init__"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
PipeLogwriter (Constructor)</h3>
<b>PipeLogwriter</b>(<i>fh</i>)
<a NAME="PipeLogwriter.run" ID="PipeLogwriter.run"></a>
<b>PipeLogwriter</b>(<i>logfilename</i>)
<p>
Instantiiert PipeLogwriter-Klasse.
</p><dl>
<dt><i>logfilename:</i></dt>
<dd>
Dateiname fuer Logdatei
</dd>
</dl><a NAME="PipeLogwriter.__del__" ID="PipeLogwriter.__del__"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
PipeLogwriter.__del__</h3>
<b>__del__</b>(<i></i>)
<a NAME="PipeLogwriter._configurefh" ID="PipeLogwriter._configurefh"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
PipeLogwriter._configurefh</h3>
<b>_configurefh</b>(<i></i>)
<p>
Konfiguriert den FileHandler fuer Ausgaben der PLCAPP.
</p><dl>
<dt>Returns:</dt>
<dd>
FileHandler-Objekt
</dd>
</dl><a NAME="PipeLogwriter.logline" ID="PipeLogwriter.logline"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
PipeLogwriter.logline</h3>
<b>logline</b>(<i>message</i>)
<p>
Schreibt eine Zeile in die Logdatei oder stdout.
</p><dl>
<dt><i>message:</i></dt>
<dd>
Logzeile zum Schreiben
</dd>
</dl><a NAME="PipeLogwriter.newlogfile" ID="PipeLogwriter.newlogfile"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
PipeLogwriter.newlogfile</h3>
<b>newlogfile</b>(<i></i>)
<p>
Konfiguriert den FileHandler auf eine neue Logdatei.
</p><a NAME="PipeLogwriter.run" ID="PipeLogwriter.run"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
PipeLogwriter.run</h3>
<b>run</b>(<i></i>)
<a NAME="PipeLogwriter.stop" ID="PipeLogwriter.stop"></a>
<p>
Prueft auf neue Logzeilen und schreibt diese.
</p><a NAME="PipeLogwriter.stop" ID="PipeLogwriter.stop"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
PipeLogwriter.stop</h3>
<b>stop</b>(<i></i>)
<p>
Beendetden Thread und die FileHandler werden geschlossen.
</p>
<div align="right"><a style="color:#0000FF" href="#top">Up</a></div>
<hr /><hr />
<a NAME="RevPiPlc" ID="RevPiPlc"></a>
@@ -251,8 +315,8 @@ Methods</h3>
<td><a style="color:#0000FF" href="#RevPiPlc.__init__">RevPiPlc</a></td>
<td>Instantiiert RevPiPlc-Klasse.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiPlc._configurefh">_configurefh</a></td>
<td></td>
<td><a style="color:#0000FF" href="#RevPiPlc._configureplw">_configureplw</a></td>
<td>Konfiguriert den PipeLogwriter fuer Ausgaben der PLCAPP.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiPlc._setuppopen">_setuppopen</a></td>
<td>Setzt UID und GID fuer das PLC Programm.</td>
@@ -264,7 +328,7 @@ Methods</h3>
<td>Setzt Prozessabbild auf NULL.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiPlc.newlogfile">newlogfile</a></td>
<td></td>
<td>Konfiguriert die FileHandler auf neue Logdatei.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiPlc.run">run</a></td>
<td>Fuehrt PLC-Programm aus und ueberwacht es.</td>
@@ -284,11 +348,18 @@ RevPiPlc (Constructor)</h3>
<b>RevPiPlc</b>(<i>program, arguments, pversion</i>)
<p>
Instantiiert RevPiPlc-Klasse.
</p><a NAME="RevPiPlc._configurefh" ID="RevPiPlc._configurefh"></a>
</p><a NAME="RevPiPlc._configureplw" ID="RevPiPlc._configureplw"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiPlc._configurefh</h3>
<b>_configurefh</b>(<i></i>)
<a NAME="RevPiPlc._setuppopen" ID="RevPiPlc._setuppopen"></a>
RevPiPlc._configureplw</h3>
<b>_configureplw</b>(<i></i>)
<p>
Konfiguriert den PipeLogwriter fuer Ausgaben der PLCAPP.
</p><dl>
<dt>Returns:</dt>
<dd>
PipeLogwriter()
</dd>
</dl><a NAME="RevPiPlc._setuppopen" ID="RevPiPlc._setuppopen"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiPlc._setuppopen</h3>
<b>_setuppopen</b>(<i></i>)
@@ -297,7 +368,7 @@ Setzt UID und GID fuer das PLC Programm.
</p><a NAME="RevPiPlc._spopen" ID="RevPiPlc._spopen"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiPlc._spopen</h3>
<b>_spopen</b>(<i>lst_proc, filenum=None</i>)
<b>_spopen</b>(<i>lst_proc</i>)
<p>
Startet das PLC Programm.
</p><dl>
@@ -320,7 +391,9 @@ Setzt Prozessabbild auf NULL.
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiPlc.newlogfile</h3>
<b>newlogfile</b>(<i></i>)
<a NAME="RevPiPlc.run" ID="RevPiPlc.run"></a>
<p>
Konfiguriert die FileHandler auf neue Logdatei.
</p><a NAME="RevPiPlc.run" ID="RevPiPlc.run"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiPlc.run</h3>
<b>run</b>(<i></i>)

View File

@@ -1,555 +0,0 @@
<!DOCTYPE html>
<html><head>
<title>revpipyload.revpipyload</title>
<meta charset="UTF-8">
</head>
<body style="background-color:#FFFFFF;color:#000000"><a NAME="top" ID="top"></a>
<h1 style="background-color:#FFFFFF;color:#0000FF">
revpipyload.revpipyload</h1>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Global Attributes</h3>
<table>
<tr><td>configrsc</td></tr><tr><td>picontrolreset</td></tr><tr><td>procimg</td></tr><tr><td>pyloadverion</td></tr>
</table>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Classes</h3>
<table>
<tr>
<td><a style="color:#0000FF" href="#LogReader">LogReader</a></td>
<td>Ermoeglicht den Zugriff auf die Logdateien.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiPlc">RevPiPlc</a></td>
<td>Verwaltet das PLC Python Programm.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiPyLoad">RevPiPyLoad</a></td>
<td>Hauptklasse, die alle Funktionen zur Verfuegung stellt.</td>
</tr>
</table>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Functions</h3>
<table>
<tr><td>None</td></tr>
</table>
<hr /><hr />
<a NAME="LogReader" ID="LogReader"></a>
<h2 style="background-color:#FFFFFF;color:#0000FF">LogReader</h2>
<p>
Ermoeglicht den Zugriff auf die Logdateien.
</p><p>
Beinhaltet Funktionen fuer den Abruf der gesamten Logdatei fuer das
RevPiPyLoad-System und die Logdatei der PLC-Anwendung.
Ausserdem koennen nur neue Zeilen abgerufen werden, um eine dynamische
Logansicht zu ermoeglichen.
</p><p>
</p>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Derived from</h3>
None
<h3 style="background-color:#FFFFFF;color:#FF0000">
Class Attributes</h3>
<table>
<tr><td>None</td></tr>
</table>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Class Methods</h3>
<table>
<tr><td>None</td></tr>
</table>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Methods</h3>
<table>
<tr>
<td><a style="color:#0000FF" href="#LogReader.__init__">LogReader</a></td>
<td>Instantiiert LogReader-Klasse.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#LogReader.get_applines">get_applines</a></td>
<td>Gibt neue Zeilen ab letzen Aufruf zurueck.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#LogReader.get_applog">get_applog</a></td>
<td>Gibt die gesamte Logdatei zurueck.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#LogReader.get_plclines">get_plclines</a></td>
<td>Gibt neue Zeilen ab letzen Aufruf zurueck.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#LogReader.get_plclog">get_plclog</a></td>
<td>Gibt die gesamte Logdatei zurueck.</td>
</tr>
</table>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Static Methods</h3>
<table>
<tr><td>None</td></tr>
</table>
<a NAME="LogReader.__init__" ID="LogReader.__init__"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
LogReader (Constructor)</h3>
<b>LogReader</b>(<i></i>)
<p>
Instantiiert LogReader-Klasse.
</p><a NAME="LogReader.get_applines" ID="LogReader.get_applines"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
LogReader.get_applines</h3>
<b>get_applines</b>(<i></i>)
<p>
Gibt neue Zeilen ab letzen Aufruf zurueck.
</p><dl>
<dt>Returns:</dt>
<dd>
list() mit neuen Zeilen
</dd>
</dl><a NAME="LogReader.get_applog" ID="LogReader.get_applog"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
LogReader.get_applog</h3>
<b>get_applog</b>(<i></i>)
<p>
Gibt die gesamte Logdatei zurueck.
</p><dl>
<dt>Returns:</dt>
<dd>
str() mit Logdaten
</dd>
</dl><a NAME="LogReader.get_plclines" ID="LogReader.get_plclines"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
LogReader.get_plclines</h3>
<b>get_plclines</b>(<i></i>)
<p>
Gibt neue Zeilen ab letzen Aufruf zurueck.
</p><dl>
<dt>Returns:</dt>
<dd>
list() mit neuen Zeilen
</dd>
</dl><a NAME="LogReader.get_plclog" ID="LogReader.get_plclog"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
LogReader.get_plclog</h3>
<b>get_plclog</b>(<i></i>)
<p>
Gibt die gesamte Logdatei zurueck.
</p><dl>
<dt>Returns:</dt>
<dd>
str() mit Logdaten
</dd>
</dl>
<div align="right"><a style="color:#0000FF" href="#top">Up</a></div>
<hr /><hr />
<a NAME="RevPiPlc" ID="RevPiPlc"></a>
<h2 style="background-color:#FFFFFF;color:#0000FF">RevPiPlc</h2>
<p>
Verwaltet das PLC Python Programm.
</p><p>
Dieser Thread startet das PLC Python Programm und ueberwacht es. Sollte es
abstuerzen kann es automatisch neu gestartet werden. Die Ausgaben des
Programms werden in eine Logdatei umgeleitet, damit der Entwickler sein
Programm analysieren und debuggen kann.
</p><p>
</p>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Derived from</h3>
Thread
<h3 style="background-color:#FFFFFF;color:#FF0000">
Class Attributes</h3>
<table>
<tr><td>None</td></tr>
</table>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Class Methods</h3>
<table>
<tr><td>None</td></tr>
</table>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Methods</h3>
<table>
<tr>
<td><a style="color:#0000FF" href="#RevPiPlc.__init__">RevPiPlc</a></td>
<td>Instantiiert RevPiPlc-Klasse.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiPlc._zeroprocimg">_zeroprocimg</a></td>
<td>Setzt Prozessabbild auf NULL.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiPlc.run">run</a></td>
<td>Fuehrt PLC-Programm aus und ueberwacht es.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiPlc.stop">stop</a></td>
<td>Beendet PLC-Programm.</td>
</tr>
</table>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Static Methods</h3>
<table>
<tr><td>None</td></tr>
</table>
<a NAME="RevPiPlc.__init__" ID="RevPiPlc.__init__"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiPlc (Constructor)</h3>
<b>RevPiPlc</b>(<i>program, pversion</i>)
<p>
Instantiiert RevPiPlc-Klasse.
</p><a NAME="RevPiPlc._zeroprocimg" ID="RevPiPlc._zeroprocimg"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiPlc._zeroprocimg</h3>
<b>_zeroprocimg</b>(<i></i>)
<p>
Setzt Prozessabbild auf NULL.
</p><a NAME="RevPiPlc.run" ID="RevPiPlc.run"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiPlc.run</h3>
<b>run</b>(<i></i>)
<p>
Fuehrt PLC-Programm aus und ueberwacht es.
</p><a NAME="RevPiPlc.stop" ID="RevPiPlc.stop"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiPlc.stop</h3>
<b>stop</b>(<i></i>)
<p>
Beendet PLC-Programm.
</p>
<div align="right"><a style="color:#0000FF" href="#top">Up</a></div>
<hr /><hr />
<a NAME="RevPiPyLoad" ID="RevPiPyLoad"></a>
<h2 style="background-color:#FFFFFF;color:#0000FF">RevPiPyLoad</h2>
<p>
Hauptklasse, die alle Funktionen zur Verfuegung stellt.
</p><p>
Hier wird die gesamte Konfiguraiton eingelesen und der ggf. aktivierte
XML-RPC-Server gestartet.
</p><p>
</p>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Derived from</h3>
proginit.ProgInit
<h3 style="background-color:#FFFFFF;color:#FF0000">
Class Attributes</h3>
<table>
<tr><td>root</td></tr>
</table>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Class Methods</h3>
<table>
<tr><td>None</td></tr>
</table>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Methods</h3>
<table>
<tr>
<td><a style="color:#0000FF" href="#RevPiPyLoad.__init__">RevPiPyLoad</a></td>
<td>Instantiiert RevPiPyLoad-Klasse.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiPyLoad._loadconfig">_loadconfig</a></td>
<td>Load configuration file and setup modul.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiPyLoad._plcthread">_plcthread</a></td>
<td>Konfiguriert den PLC-Thread fuer die Ausfuehrung.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiPyLoad._sigexit">_sigexit</a></td>
<td>Signal handler to clean and exit program.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiPyLoad._sigloadconfig">_sigloadconfig</a></td>
<td>Signal handler to load configuration.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiPyLoad.packapp">packapp</a></td>
<td>Erzeugt aus dem PLC-Programm ein TAR-File.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiPyLoad.start">start</a></td>
<td>Start plcload and PLC python program.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiPyLoad.stop">stop</a></td>
<td>Stop PLC python program and plcload.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiPyLoad.xml_getconfig">xml_getconfig</a></td>
<td>Uebertraegt die RevPiPyLoad Konfiguration.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiPyLoad.xml_getfilelist">xml_getfilelist</a></td>
<td>Uebertraegt die Dateiliste vom plcworkdir.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiPyLoad.xml_getpictoryrsc">xml_getpictoryrsc</a></td>
<td>Gibt die config.rsc Datei von piCotry zurueck.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiPyLoad.xml_getprocimg">xml_getprocimg</a></td>
<td>Gibt die Rohdaten aus piControl0 zurueck.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiPyLoad.xml_plcdownload">xml_plcdownload</a></td>
<td>Uebertraegt ein Archiv vom plcworkdir.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiPyLoad.xml_plcexitcode">xml_plcexitcode</a></td>
<td>Gibt den aktuellen exitcode vom PLC Programm zurueck.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiPyLoad.xml_plcrunning">xml_plcrunning</a></td>
<td>Prueft ob das PLC Programm noch lauft.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiPyLoad.xml_plcstart">xml_plcstart</a></td>
<td>Startet das PLC Programm.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiPyLoad.xml_plcstop">xml_plcstop</a></td>
<td>Stoppt das PLC Programm.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiPyLoad.xml_plcupload">xml_plcupload</a></td>
<td>Empfaengt Dateien fuer das PLC Programm.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiPyLoad.xml_plcuploadclean">xml_plcuploadclean</a></td>
<td>Loescht das gesamte plcworkdir Verzeichnis.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiPyLoad.xml_reload">xml_reload</a></td>
<td>Startet RevPiPyLoad neu und verwendet neue Konfiguraiton.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiPyLoad.xml_setconfig">xml_setconfig</a></td>
<td>Empfaengt die RevPiPyLoad Konfiguration.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiPyLoad.xml_setpictoryrsc">xml_setpictoryrsc</a></td>
<td>Schreibt die config.rsc Datei von piCotry.</td>
</tr>
</table>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Static Methods</h3>
<table>
<tr><td>None</td></tr>
</table>
<a NAME="RevPiPyLoad.__init__" ID="RevPiPyLoad.__init__"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiPyLoad (Constructor)</h3>
<b>RevPiPyLoad</b>(<i></i>)
<p>
Instantiiert RevPiPyLoad-Klasse.
</p><a NAME="RevPiPyLoad._loadconfig" ID="RevPiPyLoad._loadconfig"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiPyLoad._loadconfig</h3>
<b>_loadconfig</b>(<i></i>)
<p>
Load configuration file and setup modul.
</p><a NAME="RevPiPyLoad._plcthread" ID="RevPiPyLoad._plcthread"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiPyLoad._plcthread</h3>
<b>_plcthread</b>(<i></i>)
<p>
Konfiguriert den PLC-Thread fuer die Ausfuehrung.
</p><dl>
<dt>Returns:</dt>
<dd>
PLC-Thread Object or None
</dd>
</dl><a NAME="RevPiPyLoad._sigexit" ID="RevPiPyLoad._sigexit"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiPyLoad._sigexit</h3>
<b>_sigexit</b>(<i>signum, frame</i>)
<p>
Signal handler to clean and exit program.
</p><a NAME="RevPiPyLoad._sigloadconfig" ID="RevPiPyLoad._sigloadconfig"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiPyLoad._sigloadconfig</h3>
<b>_sigloadconfig</b>(<i>signum, frame</i>)
<p>
Signal handler to load configuration.
</p><a NAME="RevPiPyLoad.packapp" ID="RevPiPyLoad.packapp"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiPyLoad.packapp</h3>
<b>packapp</b>(<i>mode="tar", pictory=False</i>)
<p>
Erzeugt aus dem PLC-Programm ein TAR-File.
</p><dl>
<dt><i>mode:</i></dt>
<dd>
Packart 'tar' oder 'zip'
</dd><dt><i>pictory:</i></dt>
<dd>
piCtory Konfiguration mit einpacken
</dd>
</dl><dl>
<dt>Returns:</dt>
<dd>
Dateinamen des Archivs
</dd>
</dl><a NAME="RevPiPyLoad.start" ID="RevPiPyLoad.start"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiPyLoad.start</h3>
<b>start</b>(<i></i>)
<p>
Start plcload and PLC python program.
</p><a NAME="RevPiPyLoad.stop" ID="RevPiPyLoad.stop"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiPyLoad.stop</h3>
<b>stop</b>(<i></i>)
<p>
Stop PLC python program and plcload.
</p><a NAME="RevPiPyLoad.xml_getconfig" ID="RevPiPyLoad.xml_getconfig"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiPyLoad.xml_getconfig</h3>
<b>xml_getconfig</b>(<i></i>)
<p>
Uebertraegt die RevPiPyLoad Konfiguration.
</p><dl>
<dt>Returns:</dt>
<dd>
dict() der Konfiguration
</dd>
</dl><a NAME="RevPiPyLoad.xml_getfilelist" ID="RevPiPyLoad.xml_getfilelist"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiPyLoad.xml_getfilelist</h3>
<b>xml_getfilelist</b>(<i></i>)
<p>
Uebertraegt die Dateiliste vom plcworkdir.
</p><dl>
<dt>Returns:</dt>
<dd>
list() mit Dateinamen
</dd>
</dl><a NAME="RevPiPyLoad.xml_getpictoryrsc" ID="RevPiPyLoad.xml_getpictoryrsc"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiPyLoad.xml_getpictoryrsc</h3>
<b>xml_getpictoryrsc</b>(<i></i>)
<p>
Gibt die config.rsc Datei von piCotry zurueck.
</p><dl>
<dt>Returns:</dt>
<dd>
xmlrpc.client.Binary()
</dd>
</dl><a NAME="RevPiPyLoad.xml_getprocimg" ID="RevPiPyLoad.xml_getprocimg"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiPyLoad.xml_getprocimg</h3>
<b>xml_getprocimg</b>(<i></i>)
<p>
Gibt die Rohdaten aus piControl0 zurueck.
</p><dl>
<dt>Returns:</dt>
<dd>
xmlrpc.client.Binary()
</dd>
</dl><a NAME="RevPiPyLoad.xml_plcdownload" ID="RevPiPyLoad.xml_plcdownload"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiPyLoad.xml_plcdownload</h3>
<b>xml_plcdownload</b>(<i>mode="tar", pictory=False</i>)
<p>
Uebertraegt ein Archiv vom plcworkdir.
</p><dl>
<dt><i>mode:</i></dt>
<dd>
Archivart 'tar' 'zip'
</dd><dt><i>pictory:</i></dt>
<dd>
piCtory Konfiguraiton mit einpacken
</dd>
</dl><dl>
<dt>Returns:</dt>
<dd>
Binary() mit Archivdatei
</dd>
</dl><a NAME="RevPiPyLoad.xml_plcexitcode" ID="RevPiPyLoad.xml_plcexitcode"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiPyLoad.xml_plcexitcode</h3>
<b>xml_plcexitcode</b>(<i></i>)
<p>
Gibt den aktuellen exitcode vom PLC Programm zurueck.
</p><dl>
<dt>Returns:</dt>
<dd>
int() exitcode oder -1 lauuft noch -2 lief nie
</dd>
</dl><a NAME="RevPiPyLoad.xml_plcrunning" ID="RevPiPyLoad.xml_plcrunning"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiPyLoad.xml_plcrunning</h3>
<b>xml_plcrunning</b>(<i></i>)
<p>
Prueft ob das PLC Programm noch lauft.
</p><dl>
<dt>Returns:</dt>
<dd>
True, wenn das PLC Programm noch lauft
</dd>
</dl><a NAME="RevPiPyLoad.xml_plcstart" ID="RevPiPyLoad.xml_plcstart"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiPyLoad.xml_plcstart</h3>
<b>xml_plcstart</b>(<i></i>)
<p>
Startet das PLC Programm.
</p><dl>
<dt>Returns:</dt>
<dd>
int() Status:
-1 Programm lauft noch
100 Fehler
</dd>
</dl><a NAME="RevPiPyLoad.xml_plcstop" ID="RevPiPyLoad.xml_plcstop"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiPyLoad.xml_plcstop</h3>
<b>xml_plcstop</b>(<i></i>)
<p>
Stoppt das PLC Programm.
</p><dl>
<dt>Returns:</dt>
<dd>
int() Exitcode vom PLC Programm
</dd>
</dl><a NAME="RevPiPyLoad.xml_plcupload" ID="RevPiPyLoad.xml_plcupload"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiPyLoad.xml_plcupload</h3>
<b>xml_plcupload</b>(<i>filedata, filename</i>)
<p>
Empfaengt Dateien fuer das PLC Programm.
</p><dl>
<dt><i>filedata:</i></dt>
<dd>
GZIP Binary data der datei
</dd><dt><i>filename:</i></dt>
<dd>
Name inkl. Unterverzeichnis der Datei
</dd>
</dl><dl>
<dt>Returns:</dt>
<dd>
Ture, wenn Datei erfolgreich gespeichert wurde
</dd>
</dl><a NAME="RevPiPyLoad.xml_plcuploadclean" ID="RevPiPyLoad.xml_plcuploadclean"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiPyLoad.xml_plcuploadclean</h3>
<b>xml_plcuploadclean</b>(<i></i>)
<p>
Loescht das gesamte plcworkdir Verzeichnis.
</p><dl>
<dt>Returns:</dt>
<dd>
True, wenn erfolgreich
</dd>
</dl><a NAME="RevPiPyLoad.xml_reload" ID="RevPiPyLoad.xml_reload"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiPyLoad.xml_reload</h3>
<b>xml_reload</b>(<i></i>)
<p>
Startet RevPiPyLoad neu und verwendet neue Konfiguraiton.
</p><a NAME="RevPiPyLoad.xml_setconfig" ID="RevPiPyLoad.xml_setconfig"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiPyLoad.xml_setconfig</h3>
<b>xml_setconfig</b>(<i>dc, loadnow=False</i>)
<p>
Empfaengt die RevPiPyLoad Konfiguration.
</p><a NAME="RevPiPyLoad.xml_setpictoryrsc" ID="RevPiPyLoad.xml_setpictoryrsc"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiPyLoad.xml_setpictoryrsc</h3>
<b>xml_setpictoryrsc</b>(<i>filebytes, reset=False</i>)
<p>
Schreibt die config.rsc Datei von piCotry.
</p><dl>
<dt><i>filebytes:</i></dt>
<dd>
xmlrpc.client.Binary()-Objekt
</dd><dt><i>reset:</i></dt>
<dd>
Reset piControl Device
</dd>
</dl><dl>
<dt>Returns:</dt>
<dd>
Statuscode:
0 Alles erfolgreich
-1 Kann JSON-Datei nicht laden
-2 piCtory Elemente in JSON-Datei nicht gefunden
-3 Konnte Konfiguraiton nicht schreiben
Positive Zahl ist exitcode von piControlReset
</dd>
</dl>
<div align="right"><a style="color:#0000FF" href="#top">Up</a></div>
<hr />
</body></html>

58
revpipyload.api Normal file
View File

@@ -0,0 +1,58 @@
proginit.cleanup?4()
proginit.configure?4()
proginit.forked?7
proginit.globalconffile?7
proginit.logapp?7
proginit.logger?7
proginit.logplc?7
proginit.pargs?7
proginit.startdir?7
revpipyload.LogReader.closeall?4()
revpipyload.LogReader.get_applines?4()
revpipyload.LogReader.get_applog?4()
revpipyload.LogReader.get_plclines?4()
revpipyload.LogReader.get_plclog?4()
revpipyload.LogReader?1()
revpipyload.PipeLogwriter.__del__?6()
revpipyload.PipeLogwriter._configurefh?5()
revpipyload.PipeLogwriter.logline?4(message)
revpipyload.PipeLogwriter.newlogfile?4()
revpipyload.PipeLogwriter.run?4()
revpipyload.PipeLogwriter.stop?4()
revpipyload.PipeLogwriter?1(logfilename)
revpipyload.RevPiPlc._configureplw?5()
revpipyload.RevPiPlc._setuppopen?5()
revpipyload.RevPiPlc._spopen?5(lst_proc)
revpipyload.RevPiPlc._zeroprocimg?5()
revpipyload.RevPiPlc.newlogfile?4()
revpipyload.RevPiPlc.run?4()
revpipyload.RevPiPlc.stop?4()
revpipyload.RevPiPlc?1(program, arguments, pversion)
revpipyload.RevPiPyLoad._loadconfig?5()
revpipyload.RevPiPyLoad._plcthread?5()
revpipyload.RevPiPyLoad._sigexit?5(signum, frame)
revpipyload.RevPiPyLoad._sigloadconfig?5(signum, frame)
revpipyload.RevPiPyLoad._signewlogfile?5(signum, frame)
revpipyload.RevPiPyLoad.packapp?4(mode="tar", pictory=False)
revpipyload.RevPiPyLoad.root?7
revpipyload.RevPiPyLoad.start?4()
revpipyload.RevPiPyLoad.stop?4()
revpipyload.RevPiPyLoad.xml_getconfig?4()
revpipyload.RevPiPyLoad.xml_getfilelist?4()
revpipyload.RevPiPyLoad.xml_getpictoryrsc?4()
revpipyload.RevPiPyLoad.xml_getprocimg?4()
revpipyload.RevPiPyLoad.xml_plcdownload?4(mode="tar", pictory=False)
revpipyload.RevPiPyLoad.xml_plcexitcode?4()
revpipyload.RevPiPyLoad.xml_plcrunning?4()
revpipyload.RevPiPyLoad.xml_plcstart?4()
revpipyload.RevPiPyLoad.xml_plcstop?4()
revpipyload.RevPiPyLoad.xml_plcupload?4(filedata, filename)
revpipyload.RevPiPyLoad.xml_plcuploadclean?4()
revpipyload.RevPiPyLoad.xml_reload?4()
revpipyload.RevPiPyLoad.xml_setconfig?4(dc, loadnow=False)
revpipyload.RevPiPyLoad.xml_setpictoryrsc?4(filebytes, reset=False)
revpipyload.RevPiPyLoad?1()
revpipyload.configrsc?7
revpipyload.picontrolreset?7
revpipyload.procimg?7
revpipyload.pyloadverion?7

2
revpipyload.bas Normal file
View File

@@ -0,0 +1,2 @@
PipeLogwriter Thread
RevPiPlc Thread

View File

@@ -7,10 +7,10 @@
# -*- coding: utf-8 -*-
"""Main functions of our program."""
import logging
import os.path
import sys
from argparse import ArgumentParser
from os import fork as osfork
from os.path import exists as ospexists
forked = False
@@ -19,6 +19,7 @@ logapp = "revpipyloadapp.log"
logplc = "revpipyload.log"
logger = None
pargs = None
startdir = None
def cleanup():
@@ -54,13 +55,22 @@ def configure():
global pargs
pargs = parser.parse_args()
# Pfade absolut umschreiben
global startdir
if startdir is None:
startdir = os.path.abspath(".")
if pargs.conffile is not None and os.path.dirname(pargs.conffile) == "":
pargs.conffile = os.path.join(startdir, pargs.confffile)
if pargs.logfile is not None and os.path.dirname(pargs.logfile) == "":
pargs.logfile = os.path.join(startdir, pargs.logfile)
# Prüfen ob als Daemon ausgeführt werden soll
global forked
pidfile = "/var/run/revpipyload.pid"
pid = 0
if pargs.daemon and not forked:
# Prüfen ob daemon schon läuft
if ospexists(pidfile):
if os.path.exists(pidfile):
raise SystemError(
"program already running as daemon. check {}".format(pidfile)
)
@@ -74,16 +84,17 @@ def configure():
else:
forked = True
global logapp
global logplc
if pargs.daemon:
global logapp
global logplc
# Ausgaben umhängen in Logfile
logapp = "/var/log/revpipyloadapp"
logplc = "/var/log/revpipyload"
pargs.conffile = "/etc/revpipyload/revpipyload.conf"
sys.stdout = open(logplc, "a")
sys.stderr = sys.stdout
elif pargs.logfile is not None:
logplc = pargs.logfile
# Initialize configparser globalconfig
global globalconffile

View File

@@ -43,8 +43,9 @@ from configparser import ConfigParser
from json import loads as jloads
from re import match as rematch
from shutil import rmtree
from sys import stdout as sysstdout
from tempfile import mktemp
from threading import Thread, Event
from threading import Thread, Event, Lock
from time import sleep, asctime
from xmlrpc.client import Binary
from xmlrpc.server import SimpleXMLRPCServer
@@ -162,35 +163,107 @@ class LogReader():
class PipeLogwriter(Thread):
def __init__(self, fh):
"""File PIPE fuer das Schreiben des APP Log.
Spezieller LogFile-Handler fuer die Ausgabe des subprocess fuer das Python
PLC Programm. Die Ausgabe kann nicht auf einen neuen FileHandler
umgeschrieben werden. Dadurch waere es nicht moeglich nach einem logrotate
die neue Datei zu verwenden. Ueber die PIPE wird dies umgangen.
"""
def __init__(self, logfilename):
"""Instantiiert PipeLogwriter-Klasse.
@param logfilename: Dateiname fuer Logdatei"""
super().__init__()
self._exit = Event()
self.fh = fh
if fh is None:
self.pipeout = None
self._fh = None
self._lckfh = Lock()
self.logfile = logfilename
# Logdatei öffnen
self._fh = self._configurefh()
# Pipes öffnen
self._fdr, self.fdw = os.pipe()
proginit.logger.debug("pipe fd read: {} / write: {}".format(
self._fdr, self.fdw
))
def __del__(self):
if self._fh is not None:
self._fh.close()
def _configurefh(self):
"""Konfiguriert den FileHandler fuer Ausgaben der PLCAPP.
@returns: FileHandler-Objekt"""
proginit.logger.debug("enter PipeLogwriter._configurefh()")
dirname = os.path.dirname(self.logfile)
proginit.logger.debug("dirname = {}".format(os.path.abspath(dirname)))
if os.access(dirname, os.R_OK | os.W_OK):
logfile = open(self.logfile, "a")
else:
self._pipein, self.pipeout = os.pipe()
raise RuntimeError("can not open logfile {}".format(self.logfile))
proginit.logger.debug("leave PipeLogwriter._configurefh()")
return logfile
def logline(self, message):
"""Schreibt eine Zeile in die Logdatei oder stdout.
@param message: Logzeile zum Schreiben"""
with self._lckfh:
self._fh.write("{}\n".format(message))
self._fh.flush()
def newlogfile(self):
"""Konfiguriert den FileHandler auf eine neue Logdatei."""
proginit.logger.debug("enter RevPiPlc.newlogfile()")
with self._lckfh:
self._fh.close()
self._fh = self._configurefh()
proginit.logger.debug("leave RevPiPlc.newlogfile()")
def run(self):
if self.fh is not None:
fhread = os.fdopen(self._pipein)
proginit.logger.debug("enter logreader pipe")
while not self._exit.is_set():
line = fhread.readline()
try:
self.fh.write(line)
self.fh.flush()
except:
pass
proginit.logger.debug("leave logreader pipe")
"""Prueft auf neue Logzeilen und schreibt diese."""
proginit.logger.debug("enter PipeLogwriter.run()")
fhread = os.fdopen(self._fdr)
proginit.logger.debug("enter logreader pipe loop")
while not self._exit.is_set():
line = fhread.readline()
self._lckfh.acquire()
try:
self._fh.write(line)
self._fh.flush()
except:
proginit.logger.exception("PipeLogwriter write log line")
finally:
self._lckfh.release()
proginit.logger.debug("leave logreader pipe loop")
proginit.logger.debug("close all pipes")
os.close(self._fdr)
os.close(self.fdw)
proginit.logger.debug("closed all pipes")
proginit.logger.debug("leave PipeLogwriter.run()")
def stop(self):
proginit.logger.debug("quit pipe logreader")
"""Beendetden Thread und die FileHandler werden geschlossen."""
proginit.logger.debug("enter PipeLogwriter.stop()")
self._exit.set()
if self.pipeout is not None:
os.write(self.pipeout, b"\n")
os.close(self.pipeout)
os.close(self._pipein)
self._lckfh.acquire()
try:
os.write(self.fdw, b"\n")
except:
pass
finally:
self._lckfh.release()
proginit.logger.debug("leave PipeLogwriter.stop()")
class RevPiPlc(Thread):
@@ -211,9 +284,8 @@ class RevPiPlc(Thread):
self._arguments = arguments
self._evt_exit = Event()
self.exitcode = None
self._fh = self._configurefh()
self.gid = 65534
self.plw = None
self._plw = self._configureplw()
self._program = program
self._procplc = None
self._pversion = pversion
@@ -221,9 +293,10 @@ class RevPiPlc(Thread):
self.zeroonerror = False
self.zeroonexit = False
def _configurefh(self):
# Ausgaben konfigurieren und ggf. umleiten
proginit.logger.debug("configure fh applog")
def _configureplw(self):
"""Konfiguriert den PipeLogwriter fuer Ausgaben der PLCAPP.
@returns: PipeLogwriter()"""
proginit.logger.debug("enter RevPiPlc._configureplw()")
logfile = None
if proginit.pargs.daemon:
if os.access(os.path.dirname(proginit.logapp), os.R_OK | os.W_OK):
@@ -231,10 +304,11 @@ class RevPiPlc(Thread):
elif proginit.pargs.logfile is not None:
logfile = proginit.pargs.logfile
if logfile is not None:
return open(logfile, "a")
else:
return None
if not logfile is None:
logfile = PipeLogwriter(logfile)
proginit.logger.debug("leave RevPiPlc._configureplw()")
return logfile
def _setuppopen(self):
"""Setzt UID und GID fuer das PLC Programm."""
@@ -243,19 +317,21 @@ class RevPiPlc(Thread):
os.setgid(self.gid)
os.setuid(self.uid)
def _spopen(self, lst_proc, filenum=None):
def _spopen(self, lst_proc):
"""Startet das PLC Programm.
@param lst_proc: Prozessliste
@returns: subprocess"""
proginit.logger.debug("configure subprocess")
return subprocess.Popen(
proginit.logger.debug("enter RevPiPlc._spopen({})".format(lst_proc))
sp = subprocess.Popen(
lst_proc,
preexec_fn=self._setuppopen,
cwd=os.path.dirname(self._program),
bufsize=1,
stdout=subprocess.STDOUT if filenum is None else filenum,
stdout=sysstdout if self._plw is None else self._plw.fdw,
stderr=subprocess.STDOUT
)
proginit.logger.debug("leave RevPiPlc._spopen()")
return sp
def _zeroprocimg(self):
"""Setzt Prozessabbild auf NULL."""
@@ -264,21 +340,18 @@ class RevPiPlc(Thread):
f.write(bytes(4096))
def newlogfile(self):
if self._fh is not None:
self._fh.close()
"""Konfiguriert die FileHandler auf neue Logdatei."""
proginit.logger.debug("enter RevPiPlc.newlogfile()")
if self._plw is not None:
self._plw.newlogfile()
self._plw.logline("-" * 55)
self._plw.logline("start new logfile: {}".format(asctime()))
self._fh = self._configurefh()
if self.plw is not None:
self.plw.fh = self._fh
self._fh.write("-" * 55)
self._fh.write("\nstart new logfile: {}\n".format(asctime()))
self._fh.flush()
proginit.logger.info("new plc logfile")
proginit.logger.debug("leave RevPiPlc.newlogfile()")
def run(self):
"""Fuehrt PLC-Programm aus und ueberwacht es."""
proginit.logger.debug("enter RevPiPlc.run()")
if self._pversion == 2:
lst_proc = shlex.split("/usr/bin/env python2 -u {} {}".format(
self._program, self._arguments
@@ -288,21 +361,17 @@ class RevPiPlc(Thread):
self._program, self._arguments
))
# Logausgabe
if self._fh is not None:
self._fh.write("-" * 55)
self._fh.write("\nplc: {} started: {}\n".format(
os.path.basename(self._program), asctime()
))
self._fh.flush()
# LogWriter
self.plw = PipeLogwriter(self._fh)
self.plw.start()
# Prozess erstellen
proginit.logger.info("start plc program {}".format(self._program))
self._procplc = self._spopen(lst_proc, self.plw.pipeout)
self._procplc = self._spopen(lst_proc)
# LogWriter starten und Logausgaben schreiben
if self._plw is not None:
self._plw.logline("-" * 55)
self._plw.logline("plc: {} started: {}".format(
os.path.basename(self._program), asctime()
))
self._plw.start()
while not self._evt_exit.is_set():
@@ -333,7 +402,7 @@ class RevPiPlc(Thread):
if not self._evt_exit.is_set() and self.autoreload:
# Prozess neu starten
self._procplc = self._spopen(lst_proc, self.plw.pipeout)
self._procplc = self._spopen(lst_proc)
if self.exitcode == 0:
proginit.logger.warning(
"restart plc program after clean exit"
@@ -347,15 +416,23 @@ class RevPiPlc(Thread):
self._evt_exit.wait(1)
proginit.logger.debug("leave RevPiPlc.run()")
def stop(self):
"""Beendet PLC-Programm."""
proginit.logger.debug("enter RevPiPlc.stop()")
proginit.logger.info("stop revpiplc thread")
self._evt_exit.set()
# Prüfen ob es einen subprocess gibt
if self._procplc is None:
if self.plw is not None:
self.plw.stop()
if self._plw is not None:
self._plw.stop()
proginit.logger.debug("join after NONE pipe thread")
self._plw.join()
proginit.logger.debug("joined after NONE pipe thread")
proginit.logger.debug("leave RevPiPlc.stop()")
return
# Prozess beenden
@@ -382,8 +459,13 @@ class RevPiPlc(Thread):
or self.zeroonerror and self.exitcode != 0:
self._zeroprocimg()
if self.plw is not None:
self.plw.stop()
if self._plw is not None:
self._plw.stop()
proginit.logger.debug("join pipe thread")
self._plw.join()
proginit.logger.debug("joined pipe thread")
proginit.logger.debug("leave RevPiPlc.stop()")
class RevPiPyLoad():
@@ -554,6 +636,8 @@ class RevPiPyLoad():
# Programm aufräumen
proginit.cleanup()
proginit.logger.debug("end revpipyload program")
def _sigloadconfig(self, signum, frame):
"""Signal handler to load configuration."""
proginit.logger.debug("got reload config signal")