Skip to main content
Join the official 2020 Python Developers SurveyStart the survey!

work on time-triggered or event-triggered tasks

Project description

from pytasks import App
from datetime import datetime as dt
from datetime import timedelta as td
class T:
def __init__(self, taskid):
self.times = 10 #<--------------the largest number of this task will be executed =
self.every = td(seconds=4) #<------frequency of task being polled
self.taskid = taskid
def __call__(self): #<--------------content of task
print self.taskid, ":",
def schedule(self): #<--------------task'schedule:
return #return bool() or datetime.datetime(...)[means the time to run task]
task1 = T(1)
task2 = T(2)
#set task2's schedule
task2.schedule = lambda: True if os.environ['LOGNAME']=='root' else False
app = App()

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pytasks, version 1.3
Filename, size File type Python version Upload date Hashes
Filename, size pytasks-1.3.tar.gz (5.5 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page