仅需一步,轻松实现分布式异步任务。
Project description
仅需一步,轻松实现分布式异步任务。
Brokers
- MemoryBroker
- CronBroker
- WebHookBroker
- RabbitMQBroker
- RedisBroker
- RedisStreamBroker
- RedisPubSubBroker
- SQSBroker
- MysqlBroker
😋example
# example.py
from onestep import step, WebHookBroker
# 对外提供一个webhook接口,接收外部的消息
@step(from_broker=WebHookBroker(path="/push"))
def waiting_messages(message):
print("收到消息:", message)
if __name__ == '__main__':
step.start(block=True)
also, you can use onestep command to start, like this:
$ onestep example
then, you can send a message to webhook:
$ curl -X POST -H "Content-Type: application/json" -d '{"a": 1}' http://localhost:8090/push
🤩 other brokers
from onestep import step, CronBroker
# 每3秒触发一次任务
@step(from_broker=CronBroker("* * * * * */3", body={"a": 1}))
def cron_task(message):
assert message.body == {"a": 1}
return message
if __name__ == '__main__':
step.start(block=True)
🤔more examples: examples
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
onestep-0.5.4.tar.gz
(34.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
onestep-0.5.4-py3-none-any.whl
(34.5 kB
view details)
File details
Details for the file onestep-0.5.4.tar.gz.
File metadata
- Download URL: onestep-0.5.4.tar.gz
- Upload date:
- Size: 34.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.27 {"installer":{"name":"uv","version":"0.9.27","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5baba5df52ac4d403121adb1beff4d73923c50e82a8d3d707f406c38693fd515
|
|
| MD5 |
e11e2b2bed93d7a0a1666a4c865ee961
|
|
| BLAKE2b-256 |
b8a42a79ce0ce6ebcb02721ecd7a231c9df2df74a5cefd7468e8a958b80663fd
|
File details
Details for the file onestep-0.5.4-py3-none-any.whl.
File metadata
- Download URL: onestep-0.5.4-py3-none-any.whl
- Upload date:
- Size: 34.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.27 {"installer":{"name":"uv","version":"0.9.27","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
118859a82ed7e6a2c29a3b9a83684610a88897c9d4edd280ac2297036263c21e
|
|
| MD5 |
ca2f4c12f88dd393b717c394c35c3c77
|
|
| BLAKE2b-256 |
73ed603e869fa1ad74db48067021a610b075aa0018f347c44428ee19c39240c3
|