通过gevent使用绿色线程提供基于时间的任务调度的库。
greenclock的Python项目详细描述
绿色时钟[travs ci status](https://travis ci.org/pcdinh/greenclock.png)(https://travis-ci.org/pcdinh/greenclock)
greenclock是一个基于时间的任务调度程序,使用gevent
greenclock,您可以:将任务调度为每x秒、每天、每周、每月运行一次,
或在特定时间(如应用程序启动)。
greenclock为每个任务启动[绿色线程](http://en.wikipedia.org/wiki/green_threads)。
因此每个任务都将以并发方式执行,在不相互阻塞的情况下。
seconds
+在指定的分钟每小时运行一次,second
+在指定的时间(小时:分钟:秒)每天运行一次
+以后的更多时间
git://github.com/surfly/gevent.git@1.0rc2\egg=gevent
````
--安装选项=“--prefix=/path/to/python/app”greenclock
````
``bash
$git clone git@github.com:pcdinh/greenclock.git
$python setup.py install
`````
导入时间
def
print('+str(datetime.now())+str(datetime.now())+str(datetime.now())
time.sleep(2)
print('+str(datetime.now())+str(datetime.now())+str(datetime.now())+print('+str(datetime.now())+str(datetime.now())+str('+str(datetime.now())+str(datetime.now())+str(datetime.now())+str(datetime.now())+str调用函数函数1函数1()))
print('+str(datetime.no>
如果__=“main_uu”:
scheduler=greenclock.scheduler(logger_name=”task_u scheduler“)
scheduler.schedule('task_1',greenclock.every_second(4),func_1)
scheduler.schedule('task_2',greenclock.every_second(1),func_2)
scheduler.schedule每天41:00运行每小时任务
scheduler.schedulesecond=0),func_3)
在12:35:00运行每日任务
scheduler.schedule('task_2',greenclock.every_hour(hour=12,minute=35,second=0),func_2)
为“开始时间”指定“一次”:其他值:
scheduler.run_forever(start_at='once')
```
您需要指定以下参数:
+任务名称:`task_1`
+让计划程序知道如何运行周期性任务的计时器greenclock.every_hour(hour=1,minute=10,second=0)
````
+上述函数或可调用对象的函数或可调用对象的可选参数
```
scheduler.schedule('task_1',greenclock.every_second(1),func_1,param1,param2,NAMEDYPARAM=2)
'BR/>‘调度程序’对象可以运行一个单独的进程,如果您希望它
′
调度程序。
greenclock是一个基于时间的任务调度程序,使用gevent
greenclock,您可以:将任务调度为每x秒、每天、每周、每月运行一次,
或在特定时间(如应用程序启动)。
greenclock为每个任务启动[绿色线程](http://en.wikipedia.org/wiki/green_threads)。
因此每个任务都将以并发方式执行,在不相互阻塞的情况下。
seconds
+在指定的分钟每小时运行一次,second
+在指定的时间(小时:分钟:秒)每天运行一次
+以后的更多时间
git://github.com/surfly/gevent.git@1.0rc2\egg=gevent
````
--安装选项=“--prefix=/path/to/python/app”greenclock
````
``bash
$git clone git@github.com:pcdinh/greenclock.git
$python setup.py install
`````
导入时间
def
print('+str(datetime.now())+str(datetime.now())+str(datetime.now())
time.sleep(2)
print('+str(datetime.now())+str(datetime.now())+str(datetime.now())+print('+str(datetime.now())+str(datetime.now())+str('+str(datetime.now())+str(datetime.now())+str(datetime.now())+str(datetime.now())+str调用函数函数1函数1()))
print('+str(datetime.no>
如果__=“main_uu”:
scheduler=greenclock.scheduler(logger_name=”task_u scheduler“)
scheduler.schedule('task_1',greenclock.every_second(4),func_1)
scheduler.schedule('task_2',greenclock.every_second(1),func_2)
scheduler.schedule每天41:00运行每小时任务
scheduler.schedulesecond=0),func_3)
在12:35:00运行每日任务
scheduler.schedule('task_2',greenclock.every_hour(hour=12,minute=35,second=0),func_2)
为“开始时间”指定“一次”:其他值:
scheduler.run_forever(start_at='once')
```
您需要指定以下参数:
+任务名称:`task_1`
+让计划程序知道如何运行周期性任务的计时器greenclock.every_hour(hour=1,minute=10,second=0)
````
+上述函数或可调用对象的函数或可调用对象的可选参数
```
scheduler.schedule('task_1',greenclock.every_second(1),func_1,param1,param2,NAMEDYPARAM=2)
'BR/>‘调度程序’对象可以运行一个单独的进程,如果您希望它
′
调度程序。