Deprecate passing a worker to PipelineRunner.run()

Register the worker with PipelineRunner.add_workers() before calling
run() instead. The worker argument still works but now emits a
DeprecationWarning and will be removed in a future release.

Update the runner docstrings, the run_test() helper, and all examples
(including the asyncio.gather() forms) to use the new pattern.
This commit is contained in:
Aleix Conchillo Flaqué
2026-05-21 22:38:27 -07:00
parent e8ec7c585f
commit afa880f523
327 changed files with 734 additions and 379 deletions

View File

@@ -113,7 +113,8 @@ async def main():
runner = PipelineRunner()
await runner.run(worker)
await runner.add_workers(worker)
await runner.run()
if __name__ == "__main__":

View File

@@ -146,7 +146,8 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
runner = PipelineRunner(handle_sigint=runner_args.handle_sigint)
await runner.run(worker)
await runner.add_workers(worker)
await runner.run()
async def bot(runner_args: RunnerArguments):

View File

@@ -124,7 +124,8 @@ async def main():
runner = PipelineRunner()
await runner.run(worker)
await runner.add_workers(worker)
await runner.run()
if __name__ == "__main__":

View File

@@ -117,7 +117,8 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
await worker.cancel()
runner = PipelineRunner(handle_sigint=runner_args.handle_sigint)
await runner.run(worker)
await runner.add_workers(worker)
await runner.run()
async def bot(runner_args: RunnerArguments):

View File

@@ -118,7 +118,8 @@ async def main():
runner = PipelineRunner()
await runner.run(worker)
await runner.add_workers(worker)
await runner.run()
if __name__ == "__main__":

View File

@@ -130,7 +130,8 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
runner = PipelineRunner(handle_sigint=runner_args.handle_sigint)
await runner.run(worker)
await runner.add_workers(worker)
await runner.run()
async def bot(runner_args: RunnerArguments):