Implement 'tail' on stderr feedback

This commit is contained in:
Kristóf Tóth 2018-03-08 16:05:44 +01:00
parent f874deff6e
commit 36724c5c51

View File

@ -1,6 +1,7 @@
import xmlrpc.client import xmlrpc.client
from contextlib import suppress from contextlib import suppress
from xmlrpc.client import Fault as SupervisorFault from xmlrpc.client import Fault as SupervisorFault
from os import remove
from tfw.config import tfwenv from tfw.config import tfwenv
@ -16,7 +17,10 @@ class SupervisorMixin:
self.supervisor.startProcess(process_name) self.supervisor.startProcess(process_name)
def read_log(self, process_name): def read_log(self, process_name):
return self.supervisor.readProcessStderrLog(process_name, 0, 0) logs = self.supervisor.readProcessStderrLog(process_name, 0, 0)
remove(self.supervisor.getProcessInfo(process_name)['stderr_logfile'])
self.supervisor.clearProcessLogs(process_name)
return logs
def restart_process(self, process_name): def restart_process(self, process_name):
self.stop_process(process_name) self.stop_process(process_name)