All Projects → abo123456789 → leek

abo123456789 / leek

Licence: MIT license
Distributed task redisqueue(最简单python分布式函数调度框架)

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to leek

super-workers
🐴 Distribute load on front-end via parallelism
Stars: ✭ 93 (+55%)
Mutual labels:  thread-pool, queue-tasks
StackOverflow-Crawler
It is a web crawler which crawls the stackoverfolw website (http://stackoverflow.com/) and finds the most popular technologies at current point of time by getting the tags info of the newest questions asked on the website.
Stars: ✭ 25 (-58.33%)
Mutual labels:  web-crawler
Athena
Test your Security Skills, and Clean Code Development as a Pythonist, Hacker & Warrior 🥷🏻
Stars: ✭ 43 (-28.33%)
Mutual labels:  sqlite3
web trader
📊 Python Flask game that consolidates data from Nasdaq, allowing the user to practice buying and selling stocks.
Stars: ✭ 21 (-65%)
Mutual labels:  sqlite3
food-sqlite-demo
This tutorial we will save text from EditText and Image from gallery into SQLite database
Stars: ✭ 58 (-3.33%)
Mutual labels:  sqlite3
mqtt2sql
Copy MQTT topic payloads to MySQL/SQLite database
Stars: ✭ 54 (-10%)
Mutual labels:  sqlite3
v2ex-collections-search
v2ex收藏搜索
Stars: ✭ 21 (-65%)
Mutual labels:  sqlite3
index shotgun
duplicate index checker 🔥 🔫 👮
Stars: ✭ 35 (-41.67%)
Mutual labels:  sqlite3
birthday.py
🎉 A simple discord bot in discord.py that helps you understand the usage of SQL databases
Stars: ✭ 30 (-50%)
Mutual labels:  sqlite3
SQLiteQueryServer
Bulk query SQLite database over the network
Stars: ✭ 48 (-20%)
Mutual labels:  sqlite3
antares
A modern, fast and productivity driven SQL client with a focus in UX.
Stars: ✭ 836 (+1293.33%)
Mutual labels:  sqlite3
PT-Tracking
Aplicação para registo e acompanhamento de encomendas da CTT Expresso, automatiza a consulta online do estado de tracking para várias remessas e mantém um registo dos pagamentos referentes aos envios à cobrança. As remessas que requerem atenção, devido a atrasos na entrega ou na receção do pagamento correspondente, bem como os cheques cuja data …
Stars: ✭ 18 (-70%)
Mutual labels:  sqlite3
finger.farm
Finger.Farm Modern Finger Protocol Hosting... kind of a fingerd implementation in Node
Stars: ✭ 38 (-36.67%)
Mutual labels:  sqlite3
convert-db-to-csv
convert-db-to-csv.sh is a shell script that uses SQLite3 to convert a .db file into .csv files. It converts each of the tables in the database into csv files.
Stars: ✭ 58 (-3.33%)
Mutual labels:  sqlite3
datastation
App to easily query, script, and visualize data from every database, file, and API.
Stars: ✭ 2,519 (+4098.33%)
Mutual labels:  sqlite3
WeReadScan
扫描“微信读书”已购图书并下载本地PDF的爬虫
Stars: ✭ 273 (+355%)
Mutual labels:  web-crawler
bun
SQL-first Golang ORM
Stars: ✭ 1,570 (+2516.67%)
Mutual labels:  sqlite3
EFCore-SQLite-XamarinForms
Sample app for using Entity Framework Core 2.0 on .NET Standard with SQLite for Xamarin Forms.
Stars: ✭ 25 (-58.33%)
Mutual labels:  sqlite3
json-web-crawler
Use JSON to list all elements (with css 3 and jquery selector) that you want to crawl.
Stars: ✭ 17 (-71.67%)
Mutual labels:  web-crawler
electron-vite-boilerplate
📚 A Electron + Vite boilerplate of the nature of learning(source-code of vite-plugin-electron) / 学习性的样板工程(vite-plugin-electron源码)
Stars: ✭ 157 (+161.67%)
Mutual labels:  sqlite3

Supported Versions

中文文档 | English Docs

任务发布消费中间件

功能描述

  • 比scrapy更灵活,比celery更容易上手的分布式爬虫框架。用最少的代码,用最简单的方式,做最多的事情
  • 1分钟内能熟练运用该框架爬取数据,无需学习复杂文档.轻松扩展各种中间件

特色说明:

 支持多中间件:
    支持reids kafka sqlite memory 四种中间件(首推redis,支持批量发布任务,分布式消费快如闪电)
    
 并发支持:
    支持process threading gevent三种并发消费模式(可混合使用)
 
 控频限流:
    精确控制1秒钟运行多少次函数
 
 任务去重:
    如果重复推送消费成功的任务,自动过滤掉该任务
 
 消费确认:
    启用消费确认,消费任务宕机手动终止情况,任务不会丢失
 
 重试次数:
    当函数运行出错,会立即重试指定的次数,达到最大次重试数后任务会进入死信队列                  
 
 任务过期机制:
    如果设定某个任务过期时间,任务超过设定过期时间还未消费,则会自动丢弃该任务
 
 死信队列任务重新消费
    进入死信队列任务支持手动重入队列重新消费

pip安装

pip install leek
1.发布任务和消费任务
from leek import TaskPublisher, TaskConsumer

for zz in range(1, 11):
    TaskPublisher(queue_name='test1').pub(a=zz, b=zz)

def print_msg_dict(a, b):
    print(f"t_demo1:{a},{b}")

TaskConsumer(queue_name='test1', consuming_function=print_msg_dict).start()
2.发布任务和消费任务(更多参数实例)
from leek import get_consumer

def f(a, b):
    print(f"a:{a},b:{b}")
    print(f.meta)

consumer = get_consumer('test2', consuming_function=f, process_num=3, ack=True, task_expires=10, batch_id='2021042401')

for i in range(1, 200):
    consumer.task_publisher.pub(a=i, b=i)

consumer.start()
3.发布任务和消费任务(装饰器版本)
from leek import task_deco

@task_deco('test3')  # 消费函数上新增任务队列装饰器
def f3(a, b):
    print(f"t_demo3,a:{a},b:{b}")

# 发布任务
for i in range(1, 51):
    f3.pub(a=i, b=i)

# 消费任务
f3.start()

消费函数参数详解

get_consumer(queue_name='test11', consuming_function=f, process_num=2, threads_num=30, max_retry_times=5, qps=10, task_expires=60, batch_id='test_v1.0')
:param queue_name: 队列名称
:param consuming_function: 队列消息取出来后执行的方法
:param process_num: 启动进程数量(默认值:1)
:param threads_num: 启动线程数(默认值:8)
:param max_retry_times: 错误重试次数(默认值:3)
:param qps: 每秒限制消费任务数量(默认50)
:param middleware: 消费中间件,默认redis 支持sqlite ,kafka, memory
:param customer_type: 消费者类型 string 支持('thread','gevent') 默认thread
:param fliter_rep: 消费任务是否去重 bool True:去重 False:不去重
:param filter_field: 消费任务去重的字段,当fliter_rep为True时有效
:param max_push_size : 每次批量推送任务数量 默认值50
:param ack : 是否需要确认消费 默认值True
:param task_expires : 任务过期时间 单位/秒
:param batch_id : 批次id
:param re_queue_exception : 需要重入队列的异常

redisweb 通过浏览器查看任务消费情况

avatar

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].