Skip to content

Commit e244b2e

Browse files
committed
handle ctrl+c
1 parent 739f0c9 commit e244b2e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

demos/app_runner/app.py

100644100755
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ def _message_callback(self, ch, method, properties, body):
112112
self._launch_applications(
113113
request_message, job_dir_input, job_dir_output)
114114
self._send_acknowledgement(method.delivery_tag)
115+
self._logger.info(f"Waiting for events...")
115116

116117
def _launch_applications(self, request_message, job_dir_input, job_dir_output):
117118
applications = request_message['workflows']
@@ -185,13 +186,14 @@ def run(self):
185186
self._pika_channel.start_consuming()
186187

187188

188-
def handler(signal_received, frame):
189+
def signal_handler(signal_received, frame):
189190
# Handle any cleanup here
190191
print('SIGINT or CTRL-C detected. Exiting gracefully')
191192
sys.exit(1)
192193

193194

194195
if __name__ == "__main__":
196+
signal(SIGINT, signal_handler)
195197
logging.basicConfig(
196198
level=logging.INFO,
197199
format="%(asctime)s [%(levelname)s] %(message)s",

0 commit comments

Comments
 (0)