Using those extensions means you have the correct dependencies installed, and that you know about the external system. Django: just provide an ETLCommand class that contains all the shortcuts to write django management commands based on Bonobo. Google: shortcuts to create the necessary objects for oauth flow, with local caching of credentials. Both those extensions are not stable and will evolve.
27 lines
811 B
Python
27 lines
811 B
Python
from bonobo.execution.base import LoopingExecutionContext, recoverable
|
|
|
|
|
|
class PluginExecutionContext(LoopingExecutionContext):
|
|
PERIOD = 0.5
|
|
|
|
def __init__(self, wrapped, parent):
|
|
# Instanciate plugin. This is not yet considered stable, as at some point we may need a way to configure
|
|
# plugins, for example if it depends on an external service.
|
|
super().__init__(wrapped(self), parent)
|
|
|
|
def start(self):
|
|
super().start()
|
|
|
|
with recoverable(self.handle_error):
|
|
self.wrapped.on_start()
|
|
|
|
def shutdown(self):
|
|
if self.started:
|
|
with recoverable(self.handle_error):
|
|
self.wrapped.on_stop()
|
|
self.alive = False
|
|
|
|
def step(self):
|
|
with recoverable(self.handle_error):
|
|
self.wrapped.on_tick()
|