通过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/>‘调度程序’对象可以运行一个单独的进程,如果您希望它

调度程序。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java ParsePushReceiver参数   java如何从设备读取完整数据?   java将java_设置为home,但忽略错误   java如何从歌曲中对专辑进行排序?   java libnaude+windows 10 x64+Eclipse   java如何将maven目标更改为如图所示的想法中的quickicon?   java swing布局中心面板,可滚动显示多个窗口窗格   使用MOSQUITO代理的mqtt中的java SSL   java如何通过属性值获取XML字符串   java在服务器每次启动时停止GWT编译   java如何让javac搜索类路径的子目录?   可以比较java中的两个不同类吗?   JAVAAndroid活动内部类中的lang.NoClassDefFoundError   java HttpServletRequest获取请求头参数块   C++socket与java客户端的连接   java如何在Apache commons http客户端上使用SSL客户端证书   使用预编译正则表达式模式提高java速度   JavaRhino将两个已编译脚本合并为一个脚本