简单异步工作者
mod_ngarn的Python项目详细描述
修改ngarn
用法
Usage: mod-ngarn [OPTIONS] COMMAND [ARGS]...
Options:
--help Show this message and exit.
Commands:
create-table Create mod-ngarn queue table
delete-job Delete executed task
run Run mod-ngarn job
wait-for-notify Wait and listening for NOTIFY
安装
pip install mod-ngarn
运行modngarn
Usage: mod-ngarn run [OPTIONS]
Run mod-ngarn job
Options:
--queue-table TEXT Queue table name (Default: os.getenv("DBTABLE",
"public.modngarn_job"))
--limit INTEGER Limit jobs (Default: 300)
--max-delay FLOAT Max delay for failed jobs (seconds) (Default: None)
--help Show this message and exit.
创建modngarn作业队列表
Usage: mod-ngarn create-table [OPTIONS]
Options:
--queue-table TEXT Queue table name (Default: os.getenv("DBTABLE",
"public.modngarn_job"))
--help Show this message and exit.
等待通知
Usage: mod-ngarn wait-for-notify [OPTIONS]
Wait and listening for NOTIFY
Options:
--queue-table TEXT Queue table name (Default: os.getenv("DBTABLE",
"public.modngarn_job"))
--help Show this message and exit.
删除已执行的作业
Usage: mod-ngarn delete-job [OPTIONS]
Delete executed task
Options:
--queue-table TEXT Queue table name (Default: os.getenv("DBTABLE",
"public.modngarn_job"))
--help Show this message and exit.
示例运行脚本
#!/bin/bash
set -u
while true
do
mod-ngarn run $*
timeout 5 mod-ngarn wait-for-notify
done
开发
必需
- 传单(https://pypi.org/project/flit/)
- 运行postgresql(
psql
应该可以工作) - Python3.7
设置
flit install
运行测试
./runtests.sh
发布到pypi
flit publish
flit publish