Skip to main content

仅需一步,轻松实现分布式异步任务。

Project description


仅需一步,轻松实现分布式异步任务。

Brokers

  • MemoryBroker
  • CronBroker
  • WebHookBroker
  • RabbitMQBroker
  • RedisBroker
    • RedisStreamBroker
    • RedisPubSubBroker
  • KafkaBroker

😋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


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.4.1.tar.gz (15.7 kB view details)

Uploaded Source

Built Distribution

onestep-0.4.1-py3-none-any.whl (23.5 kB view details)

Uploaded Python 3

File details

Details for the file onestep-0.4.1.tar.gz.

File metadata

  • Download URL: onestep-0.4.1.tar.gz
  • Upload date:
  • Size: 15.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.10.14 Linux/6.5.0-1024-azure

File hashes

Hashes for onestep-0.4.1.tar.gz
Algorithm Hash digest
SHA256 e3e46299b37614f4b4ce3c25e198b8d3c10a2880ebb26c921475ce29dba0d963
MD5 2918537a87bb09c15f706d6d5b595a1d
BLAKE2b-256 1f1aed5832df0cf1254a5e9ee48984475f56f0f77f9006997f1e5f19e5ee5801

See more details on using hashes here.

File details

Details for the file onestep-0.4.1-py3-none-any.whl.

File metadata

  • Download URL: onestep-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 23.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.10.14 Linux/6.5.0-1024-azure

File hashes

Hashes for onestep-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 aeec493c68310454b3e8c17bdbe5a9780235060d701f6de02200c722fccd4245
MD5 ce20a2a1a16216f525ba806dd93efe62
BLAKE2b-256 fe602446231611d805f9a6aa943892dedbf3d12f8dc1c9b143a7f5fd832cc689

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page