You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importasynciofromtaskiq_redisimportListQueueBroker, RedisAsyncResultBackendredis_dsn='xxxx'broker=ListQueueBroker(redis_dsn, queue_name='taskiq:req').with_result_backend(
RedisAsyncResultBackend(redis_dsn)
)
@broker.taskasyncdefadd_one(value: int) ->int:
print(value, '#'*20)
returnvalue+1asyncdefmain() ->None:
# Never forget to call startup in the beginning.awaitbroker.startup()
# Send the task to the broker.task=awaitadd_one.kiq(1)
# Wait for the result.result=awaittask.wait_result(timeout=5)
print(f"Task execution took: {result.execution_time} seconds.")
ifnotresult.is_err:
print(f"Returned value: {result.return_value}")
else:
print("Error found while executing task.")
awaitbroker.shutdown()
if__name__=="__main__":
asyncio.run(main())
run the command to start worker
taskiq worker taskiq_demo:broker
run the command to run the program
python ./taskiq_demo.py
then i get a output task "..taskiq_demo:add_one" is not found. Maybe you forgot to import it?
when I stop the taskiq window and run the script again, I get a task with name ..taskiq_demo:add_one in my redis.
code in taskiq/abc/broker.py(line 317-322) produce the problem
The text was updated successfully, but these errors were encountered:
taskiq_demo.py如下
run the command to start worker
run the command to run the program
then i get a output
task "..taskiq_demo:add_one" is not found. Maybe you forgot to import it?
when I stop the taskiq window and run the script again, I get a task with name
..taskiq_demo:add_one
in my redis.code in taskiq/abc/broker.py(line 317-322) produce the problem
The text was updated successfully, but these errors were encountered: