feat: 新增技能扩展N16一章相关示例源码
This commit is contained in:
20
code/newsletter/N16/03_pipelining.py
Normal file
20
code/newsletter/N16/03_pipelining.py
Normal file
@@ -0,0 +1,20 @@
|
||||
from rocketry import Rocketry
|
||||
from rocketry.args import Return
|
||||
from rocketry.conds import after_success
|
||||
|
||||
app = Rocketry(execution="async")
|
||||
|
||||
|
||||
@app.task('every 3 second')
|
||||
def success():
|
||||
return True
|
||||
|
||||
|
||||
@app.task(after_success(success))
|
||||
def handle(is_success=Return(success)):
|
||||
status = "Done" if is_success else "Running"
|
||||
print(f"Task status is: {status}")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run()
|
||||
Reference in New Issue
Block a user