Skip to content

task is not found. Maybe you forgot to import it? #131

Closed

Description

@segfltt

If you have structure like this:

blueprint_a_folder
blueprint_b_folder
taskiq_folder
  - broker.py
  - tasks.py
main.py

and if you run taskiq inside of taskiq folder, like this:

taskiq worker broker:broker

and after that run (in my example main.py backend server file) where in some blueprint you are running tasks via kiq method, you will got this error:

task "task_a" is not found. Maybe you forgot to import it?

But if you run it like this from upper directory:

taskiq worker taskiq_folder.broker:broker

it will working fine

Hope it help someone

Activity

  1. s3rius commented on May 13, 2023

    @s3rius
    Member

    I guess there are some problems with imports. Can you please check how you import yout broker from broker.py?

    If you import it as from broker import broker then it should be fine. But I guess, that you import it as from taskiq_folder.broker import broker.

    Taskiq tries to import your broker and fails, since there's no taskiq_folder in PYTHON_PATH available.

    To make sure, that this theory is correct, please show your logs, there should be an Import error printed in logs. Since we log all unsuccessful imports.

    image

  2. s3rius commented on Jun 9, 2023

    @s3rius
    Member

    Closed due to inactivity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions