mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-11-22 16:31:32 +00:00
Allow changing MonitorManagerMixin.monitor_args dynamically
This commit is contained in:
parent
84ea46ae76
commit
211ae1e2d9
@ -10,18 +10,21 @@ class MonitorManagerMixin:
|
|||||||
def __init__(self, monitor_type, *monitor_args):
|
def __init__(self, monitor_type, *monitor_args):
|
||||||
self._monitor_type = monitor_type
|
self._monitor_type = monitor_type
|
||||||
self._monitor = None
|
self._monitor = None
|
||||||
self._monitor_args = monitor_args
|
self.monitor_args = monitor_args
|
||||||
self.reload_monitor()
|
self.reload_monitor()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def monitor(self):
|
def monitor(self):
|
||||||
return self._monitor
|
return self._monitor
|
||||||
|
|
||||||
|
def set_monitor_args(self, *monitor_args):
|
||||||
|
self.monitor_args = monitor_args
|
||||||
|
|
||||||
def reload_monitor(self):
|
def reload_monitor(self):
|
||||||
if self._monitor:
|
if self._monitor:
|
||||||
try:
|
try:
|
||||||
self._monitor.stop()
|
self._monitor.stop()
|
||||||
except KeyError:
|
except KeyError:
|
||||||
LOG.debug('Working directory was removed – ignoring...')
|
LOG.debug('Working directory was removed – ignoring...')
|
||||||
self._monitor = self._monitor_type(*self._monitor_args)
|
self._monitor = self._monitor_type(*self.monitor_args)
|
||||||
self._monitor.watch() # This runs on a separate thread
|
self._monitor.watch() # This runs on a separate thread
|
||||||
|
Loading…
Reference in New Issue
Block a user