Not-Aus verdrahtet: der Cockpit-Knopf setzt auch aus
mcp/stopp.py schreibt die Dateien nur noch ueber notaus.setzen/aufheben (eine Quelle). sicht/steuern.not_aus_setzen setzt die Dateien zuerst und ruft dann notaus() - der Not-Aus ist damit scharf, ohne ein Fenster nach vorn zu holen; scheitert der Kanal, raeumt notaus hart nach. Die Antwort nennt, was geschah (ausgesetzt / hart beendet). sicht_steuern_spec bleibt gruen.
This commit is contained in:
+2
-13
@@ -25,20 +25,9 @@ def ist_gestoppt():
|
||||
|
||||
def stopp_setzen():
|
||||
"""Legt an allen Stopp-Pfaden die Not-Aus-Datei an."""
|
||||
for p in STOPP_PFADE:
|
||||
os.makedirs(os.path.dirname(p), exist_ok=True)
|
||||
try:
|
||||
with open(p, "w", encoding="utf-8") as f:
|
||||
f.write("not-aus")
|
||||
except OSError:
|
||||
pass
|
||||
return notaus.setzen(STOPP_PFADE)
|
||||
|
||||
|
||||
def stopp_aufheben():
|
||||
"""Entfernt alle Not-Aus-Dateien."""
|
||||
for p in STOPP_PFADE:
|
||||
if os.path.exists(p):
|
||||
try:
|
||||
os.remove(p)
|
||||
except OSError:
|
||||
pass
|
||||
notaus.aufheben(STOPP_PFADE)
|
||||
|
||||
+23
-2
@@ -3,7 +3,9 @@
|
||||
Jede Funktion gibt {"ok": bool, "text": Deutsch,...} zurueck und wirft nie. Alles Schwere wird
|
||||
erst im Knopf importiert: ohne Klon, ohne Mac, ohne Laeufer startet das Cockpit trotzdem.
|
||||
|
||||
not_aus_setzen / not_aus_loeschen mcp/stopp.py (dieselben Dateien wie der Laeufer)
|
||||
not_aus_setzen / not_aus_loeschen mcp/stopp.py (dieselben Dateien wie der Laeufer);
|
||||
setzen geht dann weiter an hand/notaus.py: alle Tische
|
||||
aussetzen, kein Fenster nach vorn
|
||||
laeufer_starten / laeufer_stoppen betrieb/runner.py --act als Kindprozess, PID in
|
||||
sicht/scratch/laeufer.pid
|
||||
zuschauer_starten / zuschauer_stoppen betrieb/zuschauer_lauf.py als Kindprozess: liest nur, klickt nie
|
||||
@@ -78,6 +80,11 @@ def _stopp():
|
||||
return _modul_aus_datei("cockpit_stopp", os.path.join(WURZEL, "mcp", "stopp.py"))
|
||||
|
||||
|
||||
def _notaus():
|
||||
"""Der eine Griff (hand/notaus.py) - Datei, aussetzen, schliessen, hart."""
|
||||
return _modul_aus_datei("cockpit_notaus", os.path.join(WURZEL, "hand", "notaus.py"))
|
||||
|
||||
|
||||
def _antwort(ok, text, **mehr):
|
||||
d = {"ok": bool(ok), "text": text}
|
||||
d.update(mehr)
|
||||
@@ -91,13 +98,27 @@ def _fehler(was, e):
|
||||
# ---- Not-Aus ---------------------------------------------------------------------------------
|
||||
|
||||
def not_aus_setzen():
|
||||
"""Die Dateien zuerst (sie wirken sofort), dann der Kanal: alle Tische aussetzen.
|
||||
|
||||
Der Kanal holt kein Fenster nach vorn - der Not-Aus ist scharf, auch wenn die Tische hinten
|
||||
stehen. Bleibt der Kanal stumm, raeumt `notaus` hart nach (hand/notaus.py)."""
|
||||
try:
|
||||
s = _stopp()
|
||||
s.stopp_setzen()
|
||||
gesetzt = s.ist_gestoppt()
|
||||
return _antwort(gesetzt, "Not-Aus gesetzt" if gesetzt else "Not-Aus liess sich nicht schreiben")
|
||||
except Exception as e:
|
||||
return _fehler("Not-Aus setzen", e)
|
||||
text = "Not-Aus gesetzt" if gesetzt else "Not-Aus liess sich nicht schreiben"
|
||||
try:
|
||||
bericht = _notaus().notaus()
|
||||
aus = sum(1 for ok in bericht.get("aussetzen", {}).values() if ok)
|
||||
if aus:
|
||||
text += f" - {aus} Tisch(e) ausgesetzt"
|
||||
if bericht.get("pkill"):
|
||||
text += f", {len(bericht['pkill'])} Tischprozess(e) hart beendet"
|
||||
except Exception:
|
||||
pass # die Datei steht, der Kanal ist die Zugabe
|
||||
return _antwort(gesetzt, text)
|
||||
|
||||
|
||||
def not_aus_loeschen():
|
||||
|
||||
Reference in New Issue
Block a user