In this video we learn various methods for how we can schedule and automatically run python code. We’ll start by looking at cronjobs & windows task scheduler and then we will walk through running tasks in the cloud using AWS Lambda & Cloudwatch. The ultimate goal of this video is to learn how we can automatically generate & send an email with an analytics report every day.

There are methods highlighted in this video that will work on Mac, Linux, & Windows.

Video timeline!

  • 0:00 - What we’ll be doing in this video
  • 0:56 - Check out Skillshare! (sponsored)
  • 1:56 - How can we automate scripts? Overview of local, cloud, and serverless methods
  • 5:18 - Simple example of local script automation w/ cronjobs & windows task scheduler
  • 18:32 - How to schedule code on a cloud machine (use cronjobs)
  • 18:51 - Simple example of cloud script automation w/ AWS Lambda & Cloudwatch
  • 27:09 - Schedule & automate sending an email locally
  • 45:12 - Schedule & automate sending an email on the cloud w/ Lambda & Cloudwatch
  • 50:18 - Installing python packages in a serverless environment (zip uploads)
  • 55:50 - Generate & schedule sending analytics reports (locally)
  • 1:02:45 - Generate & schedule sending analytics reports in AWS Lambda
  • 1:07:03 - Limitations of lambda (max file upload size)
  • 1:09:00 - Generate & schedule sending analytics reports in AWS Lambda
  • 1:18:32 - Final thoughts & video recap!

~ GitHub resources ~
Link to source code: https://github.com/KeithGalli/scheduling-code
Link to analytics report code: https://github.com/KeithGalli/generate-analytics-report/tree/send_email

~ Other resources ~
Python email library docs: https://docs.python.org/3.8/library/email.examples.html
AWS Cron info (scheduling): https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/ScheduledEvents.html
Lambda package setup: https://docs.aws.amazon.com/lambda/latest/dg/python-package.html

👕 T-shirts for programmers: https://bit.ly/3ir3Gci

Subscribe: https://www.youtube.com/@KeithGalli/featured 

#python #web-development #machine-learning #programming #developer

How to Schedule & Automatically Run Python Code!
2 Likes176.80 GEEK