diff --git a/slides/sbom/python-app-deployment.md b/slides/sbom/python-app-deployment.md new file mode 100644 index 0000000..1a14357 --- /dev/null +++ b/slides/sbom/python-app-deployment.md @@ -0,0 +1,42 @@ + +# Back to our app: worker.py + +Let's follow our app from code to deployment in a container. + +During each step we'll analyze the software and show some highlights. + +--- + +Step 1: The code + +```python +import logging +import os +from redis import Redis +import requests +import time +... +redis = Redis("redis") +... +def work_loop(interval=1): + deadline = 0 + loops_done = 0 + while True: + if time.time() > deadline: + log.info("{} units of work done, updating hash counter" + .format(loops_done)) + redis.incrby("hashes", loops_done) + loops_done = 0 + deadline = time.time() + interval + work_once() + loops_done += 1 + +if __name__ == "__main__": + while True: + try: + work_loop() + except: + log.exception("In work loop:") + log.error("Waiting 10s and restarting.") + time.sleep(10) +```