onestep 0.1.5__tar.gz → 0.1.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of onestep might be problematic. Click here for more details.
- {onestep-0.1.5 → onestep-0.1.6}/PKG-INFO +1 -1
- {onestep-0.1.5 → onestep-0.1.6}/pyproject.toml +1 -1
- {onestep-0.1.5 → onestep-0.1.6}/setup.py +1 -1
- {onestep-0.1.5 → onestep-0.1.6}/src/onestep/broker/cron.py +4 -1
- {onestep-0.1.5 → onestep-0.1.6}/README.md +0 -0
- {onestep-0.1.5 → onestep-0.1.6}/src/onestep/__init__.py +0 -0
- {onestep-0.1.5 → onestep-0.1.6}/src/onestep/broker/__init__.py +0 -0
- {onestep-0.1.5 → onestep-0.1.6}/src/onestep/broker/base.py +0 -0
- {onestep-0.1.5 → onestep-0.1.6}/src/onestep/broker/memory.py +0 -0
- {onestep-0.1.5 → onestep-0.1.6}/src/onestep/broker/rabbitmq.py +0 -0
- {onestep-0.1.5 → onestep-0.1.6}/src/onestep/broker/webhook.py +0 -0
- {onestep-0.1.5 → onestep-0.1.6}/src/onestep/exception.py +0 -0
- {onestep-0.1.5 → onestep-0.1.6}/src/onestep/message.py +0 -0
- {onestep-0.1.5 → onestep-0.1.6}/src/onestep/middleware/__init__.py +0 -0
- {onestep-0.1.5 → onestep-0.1.6}/src/onestep/middleware/base.py +0 -0
- {onestep-0.1.5 → onestep-0.1.6}/src/onestep/middleware/config.py +0 -0
- {onestep-0.1.5 → onestep-0.1.6}/src/onestep/onestep.py +0 -0
- {onestep-0.1.5 → onestep-0.1.6}/src/onestep/retry.py +0 -0
- {onestep-0.1.5 → onestep-0.1.6}/src/onestep/signal.py +0 -0
- {onestep-0.1.5 → onestep-0.1.6}/src/onestep/state.py +0 -0
- {onestep-0.1.5 → onestep-0.1.6}/src/onestep/store/__init__.py +0 -0
- {onestep-0.1.5 → onestep-0.1.6}/src/onestep/store/rabbitmq.py +0 -0
- {onestep-0.1.5 → onestep-0.1.6}/src/onestep/worker.py +0 -0
|
@@ -18,7 +18,7 @@ extras_require = \
|
|
|
18
18
|
|
|
19
19
|
setup_kwargs = {
|
|
20
20
|
'name': 'onestep',
|
|
21
|
-
'version': '0.1.
|
|
21
|
+
'version': '0.1.6',
|
|
22
22
|
'description': '',
|
|
23
23
|
'long_description': '# OneStep\n\n<a href="https://github.com/mic1on/onestep/actions/workflows/test.yml?query=event%3Apush+branch%3Amain" target="_blank">\n <img src="https://github.com/mic1on/onestep/workflows/test%20suite/badge.svg?branch=main&event=push" alt="Test">\n</a>\n<a href="https://pypi.org/project/onestep" target="_blank">\n <img src="https://img.shields.io/pypi/v/onestep.svg" alt="Package version">\n</a>\n\n<a href="https://pypi.org/project/onestep" target="_blank">\n <img src="https://img.shields.io/pypi/pyversions/onestep.svg" alt="Supported Python versions">\n</a>\n\n<hr />\n仅需一步,轻松实现分布式异步任务。\n\n## Brokers\n\n- [x] MemoryBroker\n- [x] CronBroker\n- [x] WebHookBroker\n- [x] RabbitMQBroker\n- [ ] RedisBroker\n- [ ] KafkaBroker\n\n## example\n\n```python\nfrom onestep import step, WebHookBroker\n\n\n# 对外提供一个webhook接口,接收外部的消息\n@step(from_broker=WebHookBroker(path="/push"))\ndef waiting_messages(message):\n print("收到消息:", message)\n\n\nif __name__ == \'__main__\':\n step.start(block=True)\n```\n\n```python\nfrom onestep import step, CronBroker\n\n\n# 每3秒触发一次任务\n@step(from_broker=CronBroker("* * * * * */3", a=1))\ndef cron_task(message):\n assert message.body == {"a": 1}\n return message\n\n\nif __name__ == \'__main__\':\n step.start(block=True)\n```\n\n更多例子请参阅:[examples](example)',
|
|
24
24
|
'author': 'miclon',
|
|
@@ -19,10 +19,13 @@ class CronBroker(BaseLocalBroker):
|
|
|
19
19
|
self.kwargs = kwargs
|
|
20
20
|
self._scheduler()
|
|
21
21
|
|
|
22
|
+
def _real_task(self):
|
|
23
|
+
self.queue.put_nowait(self.kwargs)
|
|
24
|
+
|
|
22
25
|
def _scheduler(self):
|
|
23
26
|
if self.next_fire_time <= datetime.now():
|
|
24
27
|
self.next_fire_time = self.itr.get_next(datetime)
|
|
25
|
-
self.
|
|
28
|
+
self._real_task()
|
|
26
29
|
|
|
27
30
|
threading.Timer(interval=1, function=self._scheduler).start()
|
|
28
31
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|