feat: 新增技能扩展N16一章相关示例源码

This commit is contained in:
100gle
2023-03-09 09:44:25 +08:00
parent e963474669
commit ed9a0be0bd
5 changed files with 124 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
from rocketry import Rocketry
app = Rocketry()
def get_params():
yield {"name": "100gle"}
yield {}
@app.task()
def greet(name=None):
msg = name or "world"
print(f"Hello, {msg}!")
@app.task('every 3 second', execution="thread")
def do_callback():
for params in get_params():
task = app.session["greet"]
task.run(**params)
if __name__ == '__main__':
app.run()