Skip to content

Commit bc6d688

Browse files
author
Nathan Lee
committed
Rename of app lifecycle hooks
1 parent 3d16cc9 commit bc6d688

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

pyrunner/core/pyrunner.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def __init__(self, **kwargs):
5858
'exec_to_id' : None
5959
}
6060

61-
self._on_fresh_start_func = None
61+
self._on_create_func = None
6262
self._on_start_func = None
6363
self._on_restart_func = None
6464
self._on_success_func = None
@@ -122,8 +122,8 @@ def plugin_notification(self, obj):
122122
self.notification = obj
123123

124124
# App lifecycle hooks
125-
def on_fresh_start(self, func):
126-
self._on_fresh_start_func = func
125+
def on_create(self, func):
126+
self._on_create_func = func
127127
def on_start(self, func):
128128
self._on_start_func = func
129129
def on_restart(self, func):
@@ -132,8 +132,8 @@ def on_success(self, func):
132132
self._on_success_func = func
133133
def on_fail(self, func):
134134
self._on_fail_func = func
135-
def on_exit(self, func):
136-
self._on_exit_func = func
135+
def on_destroy(self, func):
136+
self._on_destroy_func = func
137137

138138
def prepare(self):
139139
# Initialize NodeRegister
@@ -163,16 +163,16 @@ def execute(self):
163163
def run(self):
164164
self.prepare()
165165

166-
# App lifecycle - START
167-
if self._on_start_func:
168-
self._on_start_func()
169-
170166
# App lifecycle - RESTART
171167
if self._init_params['restart']:
172168
if self._on_restart_func: self._on_restart_func()
173-
# App lifecycle - FRESH START
169+
# App lifecycle - CREATE
174170
else:
175-
if self._on_fresh_start_func: self._on_fresh_start_func()
171+
if self._on_create_func: self._on_create_func()
172+
173+
# App lifecycle - START
174+
if self._on_start_func:
175+
self._on_start_func()
176176

177177
self.config['app_start_time'] = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
178178

@@ -207,9 +207,9 @@ def run(self):
207207
print('Skipping Email Notification: Property "email_on_fail" is set to FALSE.')
208208
emit_notification = False
209209

210-
# App lifecycle - EXIT
211-
if self._on_exit_func:
212-
self._on_exit_func()
210+
# App lifecycle - DESTROY
211+
if self._on_destroy_func:
212+
self._on_destroy_func()
213213

214214
if emit_notification:
215215
self.notification.emit_notification(self.config, self.register)

0 commit comments

Comments
 (0)