Skip to content

Instantly share code, notes, and snippets.

@pratik-choudhari
Created August 29, 2021 02:45
Show Gist options
  • Select an option

  • Save pratik-choudhari/df43d5bc75332db60d83e49eab147567 to your computer and use it in GitHub Desktop.

Select an option

Save pratik-choudhari/df43d5bc75332db60d83e49eab147567 to your computer and use it in GitHub Desktop.
scheduling using threads
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