Skip to content

Commit 0e08033

Browse files
author
Nathan Lee
committed
Added on_start app lifecycle hook and fixed a config name error
1 parent 6ebd546 commit 0e08033

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

pyrunner/core/pyrunner.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ def __init__(self, **kwargs):
5757
'exec_to_id' : None
5858
}
5959

60+
self._on_start_func = None
6061
self._on_restart_func = None
6162
self._on_success_func = None
6263
self._on_fail_func = None
@@ -122,6 +123,8 @@ def plugin_notification(self, obj):
122123
if not isinstance(obj, notification.Notification): raise Exception('Notification plugin must implement the Notification interface')
123124
self.notification = obj
124125

126+
def on_start(self, func):
127+
self._on_start_func = func
125128
def on_restart(self, func):
126129
self._on_restart_func = func
127130
def on_success(self, func):
@@ -157,6 +160,10 @@ def run(self):
157160
if self._init_params['exec_to_id'] is not None:
158161
self.exec_to(self._init_params['exec_to_id'])
159162

163+
# App lifecycle - START
164+
if self._on_start_func:
165+
self._on_start_func()
166+
160167
# App lifecycle - RESTART
161168
if self._init_params['restart'] and self._on_restart_func:
162169
self._on_restart_func()
@@ -183,7 +190,7 @@ def run(self):
183190
if retcode == 0:
184191
if self._on_success_func:
185192
self._on_success_func()
186-
if not self.config['email_on_succss']:
193+
if not self.config['email_on_success']:
187194
print('Skipping Email Notification: Property "email_on_success" is set to FALSE.')
188195
emit_notification = False
189196
# # App lifecycle - FAIL

pyrunner/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '4.1.0'
1+
__version__ = '4.1.1'

0 commit comments

Comments
 (0)