Skip to content

Commit ef4a1d5

Browse files
author
Joel Collins
committed
Added example atexit code
1 parent b29b373 commit ef4a1d5

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

examples/builder.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
import uuid
22
import types
33
import functools
4+
import atexit
5+
import logging
46

57
from labthings.server.quick import create_app, property_of
68

79
from components.pdf_component import PdfComponent
810

911

12+
def cleanup():
13+
logging.info("Exiting. Running any cleanup code here...")
14+
15+
1016
# Create LabThings Flask app
1117
app, labthing = create_app(
1218
__name__,
@@ -34,6 +40,8 @@
3440
"/dictionary",
3541
)
3642

43+
atexit.register(cleanup)
44+
3745
# Start the app
3846
if __name__ == "__main__":
3947
from labthings.server.wsgi import Server

0 commit comments

Comments
 (0)