-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
@broker.task
async def add_one(value: int) -> int:
return value + 1
class A(BaseModel):
a:int = 1
b:int = 1
async def main(x=A) -> None:
logfire.debug(f"Starting task with input: {x}")
await broker.startup()
# Send the task to the broker.
task = await add_one.kiq(1)
logger.debug(task.__dict__)
# Wait for the result.
# result = await task.wait_result()
result = await task.wait_result(timeout=2000, with_logs=True)
print(f"Task execution took: {result.execution_time} seconds.")
if not result.is_err:
print(f"Returned value: {result.return_value}")
else:
print("Error found while executing task.")
await broker.shutdown()Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels