How to Schedule & Automatically Run Python Code!

Share this & earn $10
Keith Galli
Published at : 28 Nov 2020
2015 views
190
1

The first 1000 people to use the link will get a free trial of Skillshare Premium Membership: https://skl.sh/keithgalli11201

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.

~ 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

~ Relevant videos ~
How to generate an analytics report in python: https://youtu.be/UmN2_R4KEg8
How to send an email with python (@Corey Schafer ): https://youtu.be/JRCJ6RtE3xU

~ Articles mentioned ~
AWS Lambda memory limits: https://hackernoon.com/exploring-the-aws-lambda-deployment-limits-9a8384b0bec3
Downloading python linux libraries on Windows: https://medium.com/@korniichuk/lambda-with-pandas-fd81aa2ff25e

~ 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

Thank you to Skillshare for sponsoring this video!

-------------------------
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!

-------------------------
Follow me on social media!
Instagram | https://www.instagram.com/keithgalli/
Twitter | https://twitter.com/keithgalli

-------------------------
If you are curious to learn how I make my tutorials, check out this video: https://youtu.be/LEO4igyXbLs

⭐ Kite is a free AI-powered coding assistant that will help you code faster and smarter. The Kite plugin integrates with all the top editors and IDEs to give you smart completions and documentation while you’re typing. I've been using Kite for 6 months and I love it! https://www.kite.com/get-kite/?utm_medium=referral&utm_source=youtube&utm_campaign=keithgalli&utm_content=description-only

*I use affiliate links on the products that I recommend. I may earn a purchase commission or a referral bonus from the usage of these links.
Keith Gallipythonprogramming

My A-Z of the BEST new cars coming 2020-2022 from the 'Geneva' Motor Show

My A-Z of the BEST new cars coming 2020-2022 from the 'Geneva' Motor Show

TWICE SPECIAL LIVE "MORE & MORE"

TWICE SPECIAL LIVE "MORE & MORE"

The history of marriage - Alex Gendler

The history of marriage - Alex Gendler

What Happened To Tesla's Solar Roof Tiles?

What Happened To Tesla's Solar Roof Tiles?

Extreme small plane landing on a ship at sea - and subsequent takeoff

Extreme small plane landing on a ship at sea - and subsequent takeoff

Knuckles Approved Meme Compilation

Knuckles Approved Meme Compilation

Enzymes- a fun introduction

Enzymes- a fun introduction

Gw Reaksi Meme Yang Kalian Bikin Untuk Gw ... (Cone Tall, May Make)

Gw Reaksi Meme Yang Kalian Bikin Untuk Gw ... (Cone Tall, May Make)

5 Most Profitable Business Ideas for 2020 🔥(UPDATED)

5 Most Profitable Business Ideas for 2020 🔥(UPDATED)

The Rolling Stones - Midnight Rambler (Live) - OFFICIAL

The Rolling Stones - Midnight Rambler (Live) - OFFICIAL

Solo Female Nomad/7 Mile Bridge Florida Keys

Solo Female Nomad/7 Mile Bridge Florida Keys

Vishal Mega Mart New Arrivals | Kitchen Organizers ,Hosehold & Many Useful Items Under Rs.99 |

Vishal Mega Mart New Arrivals | Kitchen Organizers ,Hosehold & Many Useful Items Under Rs.99 |

Nalin & Kane - Crusing ( Video by  B.r.T   &  DjQ'b

Nalin & Kane - Crusing ( Video by B.r.T & DjQ'b

THIS CLUTCH MIGHT GET ME SIGNED TO 100T! COD: Warzone Gameplay

THIS CLUTCH MIGHT GET ME SIGNED TO 100T! COD: Warzone Gameplay

Gleaming Finds - Gleaming Cephalops

Gleaming Finds - Gleaming Cephalops

How fast will I lose weight on Alipotec Raiz de Tejocote Dietary Supplement?

How fast will I lose weight on Alipotec Raiz de Tejocote Dietary Supplement?

How I Fixed my Irritated Skin Quickly | Tips and Routine

How I Fixed my Irritated Skin Quickly | Tips and Routine

2016 A Simple Task - final performance.

2016 A Simple Task - final performance.

Diddy Hosts Mom Janice 80th B-Day Dinner! 🍽

Diddy Hosts Mom Janice 80th B-Day Dinner! 🍽

forcing myself to level up while i feel out of place

forcing myself to level up while i feel out of place

TONES AND I - NEVER SEEN THE RAIN (OFFICIAL VIDEO)

TONES AND I - NEVER SEEN THE RAIN (OFFICIAL VIDEO)

Jimi Hendrix 'Voodoo Child' (Slight Return)

Jimi Hendrix 'Voodoo Child' (Slight Return)

Chicken Out | Verlag: Piatnik

Chicken Out | Verlag: Piatnik

How do negative interest rates work? | CNBC Explains

How do negative interest rates work? | CNBC Explains

Tiling the Mudroom

Tiling the Mudroom

Dr. Oz Teaches 300 Men How to Check for Testicular Cancer | The Oprah Winfrey Show | OWN

Dr. Oz Teaches 300 Men How to Check for Testicular Cancer | The Oprah Winfrey Show | OWN

BioPharma Penny Stock With +300% Potential Upside! Analysts Rate Strong Buy!!

BioPharma Penny Stock With +300% Potential Upside! Analysts Rate Strong Buy!!

Bulldogs Frantically Warn TV Canine Of Danger in Classic Horror Scene

Bulldogs Frantically Warn TV Canine Of Danger in Classic Horror Scene

The Most Satisfying Slime ASMR Videos | Relaxing Oddly Satisfying Slime 2020 | 673

The Most Satisfying Slime ASMR Videos | Relaxing Oddly Satisfying Slime 2020 | 673

Stephen A. goes off on Damien Woody for suggesting the Bucs could miss the playoffs | First Take

Stephen A. goes off on Damien Woody for suggesting the Bucs could miss the playoffs | First Take

An Especially Noble Calling

An Especially Noble Calling

🔵 Tousle - Tousled Meaning - Tousle Examples - Tousled Defined

🔵 Tousle - Tousled Meaning - Tousle Examples - Tousled Defined

My 2020 C8 Corvette parts were STOLEN from my home...

My 2020 C8 Corvette parts were STOLEN from my home...

How To Guarantee that OVER 10% Of Agents Will Open and VIEW Your E Flyer

How To Guarantee that OVER 10% Of Agents Will Open and VIEW Your E Flyer

Interactive Phonetic chart for English Pronunciation

Interactive Phonetic chart for English Pronunciation

Frank Sinatra - You'll Get Yours

Frank Sinatra - You'll Get Yours

Coronavirus: Sweden shifts COVID-19 strategy as second wave surges

Coronavirus: Sweden shifts COVID-19 strategy as second wave surges

Who Owns The Stock Market? (It's Not Guys Like Me Or You)

Who Owns The Stock Market? (It's Not Guys Like Me Or You)

Cohesion and Coherence

Cohesion and Coherence

Tilapia Harvest From Small Fishpond | Buhay Probinsya

Tilapia Harvest From Small Fishpond | Buhay Probinsya

[Vietsub] Criminal - Britney Spears

[Vietsub] Criminal - Britney Spears

Music for Lonely Dogs! Keep Your Dog Relaxed and Happy with this Music!

Music for Lonely Dogs! Keep Your Dog Relaxed and Happy with this Music!

How To Go From A Basic To An Advanced Response In English

How To Go From A Basic To An Advanced Response In English

Cold symptoms and remedies

Cold symptoms and remedies

There is/are There isn't/aren't

There is/are There isn't/aren't

Westlife - Hard to Say I'm Sorry (Official Audio)

Westlife - Hard to Say I'm Sorry (Official Audio)

You Would Wishes To Form How | My First Video

You Would Wishes To Form How | My First Video

Why more millennials are quitting lucrative jobs to travel

Why more millennials are quitting lucrative jobs to travel

Mudra Loan Online Apply | mudra loan online apply kaise kare | Mudra loan PMMY 2021

Mudra Loan Online Apply | mudra loan online apply kaise kare | Mudra loan PMMY 2021