Skip to main content

Example

#test.py
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.now = dt.now()
self.every = td(seconds=4) #<------frequency of task being polled
self.taskid = taskid
def __call__(self): #<--------------content of task
print self.taskid, ":", dt.now()-self.now
self.now =dt.now()
def schedule(self): #<--------------task'schedule:
return dt.now()+td(seconds=2) #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()
app.add(task1)
app.add(task2
app.run()

Release files for pytasks 1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytasks 1.3
File Size Uploaded
pytasks-1.3.tar.gz 5.5 kB Details

Release files / pytasks-1.3.tar.gz

Download URL pytasks-1.3.tar.gz
Size 5.5 kB
Tags Source
SHA-256 checksum
How to use checksums
3fb0cd97557eacbe2e5a336a8921356de2d3a19250146d4a0e6f331c8e6c07e4
BLAKE2b-256 checksum
How to use checksums
ad58b883489c1bfc565a69cac34bf762fec61c2cd65cdc5ada718077fc395da3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

1.3 This release

1 release file

1.2

1 release file

1.1

1 release file

1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page