Skip to content
This repository was archived by the owner on Aug 24, 2024. It is now read-only.
This repository was archived by the owner on Aug 24, 2024. It is now read-only.

Cannot import name 'Interval' #70

@AdoniasAlcantara

Description

@AdoniasAlcantara

when trying to run the example from the README I get the error:

File "/home/adonias/Workspaces/Training/celery_test/proj.py", line 11, in <module>
    from celerybeatmongo.models import PeriodicTask, Interval
ImportError: cannot import name 'Interval' from 'celerybeatmongo.models' (/home/adonias/.local/lib/python3.8/site-packages/celerybeatmongo/models.py)

Any idea why this error?

from celery import Celery

config = {
    "mongodb_scheduler_db": "my_project",
    "mongodb_scheduler_url": "mongodb://localhost:27017",
}

app = Celery('hello', broker='redis://localhost//')
app.conf.update(**config)

from celerybeatmongo.models import PeriodicTask, Interval

periodic = PeriodicTask(
    name='Importing contacts',
    task="proj.import_contacts",
    interval=Interval(every=10, period="seconds") # executes every 10 seconds.
)
periodic.save()

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