Created
August 29, 2021 02:45
-
-
Save pratik-choudhari/df43d5bc75332db60d83e49eab147567 to your computer and use it in GitHub Desktop.
scheduling using threads
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import time | |
| import threading | |
| def task(): | |
| print("Job Completed!") | |
| def schedule(): | |
| while 1: | |
| task() | |
| time.sleep(10) | |
| # makes our logic non blocking | |
| thread = threading.Thread(target=schedule) | |
| thread.start() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment