Skip to content

The task is stuck here. How to fix it? #16

@yuanjie-ai

Description

@yuanjie-ai
Image
@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()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions