Quick actions

cmd+k|ctrl+k

Navigation

Languages

sched

Snippet info

Language

Python

Visibility

public

Author

chad

Created

2016-05-24T01:53:35Z

Updated

2016-05-24T01:53:35Z

from sched import scheduler, time

task_scheduler = scheduler(time.time, time.sleep)

def do_task(*args, **kwargs):
    print("{0}: args={1}, kwargs={2}".format(time.time(), args, kwargs))

task_scheduler.enter(2, 1, do_task, argument=("#1",))
task_scheduler.enter(5, 1, do_task, argument=("#2",), kwargs={"ABC": 123})
task_scheduler.enter(8, 1, do_task, argument=("#3",))
task_scheduler.run()
INFO