A very light library to run python functions like cron jobs do

Overview

cron_lite

A very light library to run python functions like cron jobs do. (support cron expressions, decorator style, spawn running and graceful exit. Runs in python service like Apscheduler, no effect of system config)

Example

from cron_lite import cron_task, start_all, stop_all
import time


@cron_task("* * * * * 0/2")
def event1():
    print("event1", time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time())))
    time.sleep(3)
    print("event1 done", time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time())))

@cron_task("* * * * * 0/15")
def event2():
    print("event2", time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time())))
    time.sleep(10)
    print("event2 done", time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time())))


th = start_all(spawn=True)  # use bare `start_all()` to run forever as a service
print("start")
time.sleep(60)
print("stop")
stop_all(th)
print("done")
You might also like...

Run helmet detection on images in your browser. TensorFlow Object Detection used to run inference using SSD-MobileNet V2.

Helmet Detector Helmet detection using TensorFlow Object Detection SSD MobileNet V2 FPNLite to make inferences API exposed using Flask Live web app de

Apr 15, 2022

unofficial linkedin api for finding jobs and searching for/connecting with users

LinkedIn REST Unofficial API (python) A simple unofficial LinkedIn python api providing basic LinkedIn functionality. Programmatically find jobs and s

Aug 1, 2022

Used Selenium to scrape the latest jobs (swe internships) on linkedin.

A very basic webscraper that gives you the newest SWE internships on LinkedIn. I reccomend you use the link that contains all the internships within t

Sep 8, 2022

This code is used to populate the "ODS jobs dump" Telegram bot, and it can be used for any other dumped Slack channel

Sending ODS Slack dump to a Telegram channel OpenDataScience ods.ai is an international Data Science community, mostly Russian-speaking. As a result o

Dec 15, 2022

A driver to run wasm code from an emscripten-forge coda env like normal python code

pyjs-code-runner A driver to run python code in a wasm environment, almost like running vanilla python code. Examples Here we assume a file main.py lo

Nov 4, 2022

This is Template of Django Project to Run or Deploy the Django Project In Services Like Replit, CodeSandbox, Heroku etc.,

django_template This is Template of Django Project Run or Deploy the Django Project In Services Like Replit, CodeSandbox, Heroku etc., This Repository

Apr 16, 2022

A set of Twitch tools for functions like Creating accounts, Following Users, and more!

A set of Twitch tools for functions like Creating accounts, Following Users, and more! Contents Features Installation Usage Contributing License Quest

Dec 22, 2022

Pyside Ramp Widget that looks and functions just like Autodesk Maya's ramp widget

Pyside Ramp Widget that looks and functions just like Autodesk Maya's ramp widget

Maya Ramp Widget Pyside Ramp Widget that looks and functions just like Autodesk Maya's ramp widget Features Functions similarly to Autodesk Maya's Ram

Nov 17, 2022

A library written in Python to control Fisba ReadyBeam laser light source.

A libray to control the Fisba ReadyBeam laser light sources. At this time, this code is only tested on an Ubuntu 22.04 operating system.

Dec 10, 2022
Owner
Rainy Chan
errors make growth
Rainy Chan
Light musician is a tool to convert song to its light version. With Light Player, vocals in a song can be convert to other instruments using vst plugin.

Light musician is a tool to convert song to its light version. With Light Player, vocals in a song can be convert to other instruments using vst plugi

Nardo 12 Dec 29, 2022
Light musician is a tool to convert song to its light version. With Light Player, vocals in a song can be convert to other instruments using vst plugin.

Light musician is a tool to convert song to its light version. With Light Player, vocals in a song can be convert to other instruments using vst plugi

Nardo 11 Aug 15, 2022
Lug lets you run Python functions paired with any Docker container. The packaged function and image can run locally or in the cloud.

Lug is an open source package that redirects Python calls to subprocess.run, subprocess.Popen, and os.system into any Docker container. This makes these system-level Python calls behave the same way on different machines, without requiring any changes to the Docker container.

Toolchest 14 Nov 3, 2022
🔏 A cron job to automatically renew the SSL certificate of your Porkbun domain

porkcron A cron job to automatically renew the SSL certificate of your Porkbun domain ?? About porkcron is a simple alternative to certbot. If you own

Tom 1 Sep 29, 2022
This repository is create for implement the cron with the PortMonitor to get public IP's open/filtered port scan result of specific AWS EC2 region on Slack

Port Monitor Cron This is a implementation with AWS and PortMonitor, This repository has main.py which pick specific region ( need to configure manual

Rudra Sarkar 2 Aug 29, 2022
A very light weight bank management system, built with python and sqlite3

Bank-Management A very light weight terminal-based bank management system, built with pure python and sqlite3 What is it made for? Admin side of the s

VanshKhera 0 Jun 18, 2022
A very simple email spam bot. Not much to it. Just make sure you have python installed when you run it and have fun!

Simple-Email-Spam-Bot A very simple email bot I made with python. Not much to it. Just make sure you have python installed when you run it and have fu

null 1 Jul 7, 2022
How to Run Python Code Interactively A widely used way to run Python code is through an interactive session

This is a very simple text-based game in python. It a small quiz which you can make for yourself as well or your friends. We do not need to import any modules for this game which makes it easier! Try it yourself ??

null 1 Jul 8, 2022
Simulating Acela run from Boston to WDC and local run of New London to Stamford CT. Using Python, Raspberry PI 4 to control Lego Trains and TrixBrix Hardware.

#Latest Update Version 0.1.1 Adding Speed and Motion Direction routines #Introduction This project simulates Acela (Boston to Washington, DC with stop

null 1 Apr 8, 2022
Python scripts for ETL (extract, transform and load) jobs for Klaytn blocks, transactions, ERC20 / ERC721 tokens, transfers, receipts, logs, contracts, internal transactions.

Klaytn ETL Klaytn ETL lets you convert Klaytn blockchain data into convenient formats like JSONs, CSVs and relational databases. This is a fork of Eth

Klaytn 16 Dec 15, 2022