{"id":20528746,"url":"https://github.com/zmap/celerybeat-mongo","last_synced_at":"2025-05-09T11:30:39.309Z","repository":{"id":15634910,"uuid":"18371831","full_name":"zmap/celerybeat-mongo","owner":"zmap","description":"A Celery Beat Scheduler that uses MongoDB to store both schedule definitions and status information","archived":false,"fork":false,"pushed_at":"2022-11-16T10:42:33.000Z","size":79,"stargazers_count":123,"open_issues_count":17,"forks_count":43,"subscribers_count":17,"default_branch":"master","last_synced_at":"2024-04-14T18:13:23.208Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zmap.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-04-02T15:46:05.000Z","updated_at":"2024-03-31T22:43:18.000Z","dependencies_parsed_at":"2023-01-13T18:31:20.907Z","dependency_job_id":null,"html_url":"https://github.com/zmap/celerybeat-mongo","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zmap%2Fcelerybeat-mongo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zmap%2Fcelerybeat-mongo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zmap%2Fcelerybeat-mongo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zmap%2Fcelerybeat-mongo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zmap","download_url":"https://codeload.github.com/zmap/celerybeat-mongo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224859086,"owners_count":17381649,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-15T23:26:59.814Z","updated_at":"2024-11-15T23:27:00.554Z","avatar_url":"https://github.com/zmap.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"celerybeat-mongo\n################\n\nThis is a `Celery Beat Scheduler \u003chttp://celery.readthedocs.org/en/latest/userguide/periodic-tasks.html/\u003e`_\nthat stores both the schedules themselves and their status\ninformation in a backend Mongo database. It can be installed by\ninstalling the celerybeat-mongo Python egg::\n\n    # pip install celerybeat-mongo\n\nAnd specifying the scheduler when running Celery Beat, e.g.::\n\n    $ celery beat -S celerybeatmongo.schedulers.MongoScheduler\n\nSettings\n########\n\nThe settings for the scheduler are defined in your celery configuration file\nsimilar to how other aspects of Celery are configured:\n\n* mongodb_scheduler_url: The mongodb `url \u003chttps://docs.mongodb.com/manual/reference/connection-string/\u003e`_ connection used to store task results.\n* mongodb_scheduler_db: The Mongodb database name\n* mongodb_scheduler_collection (optional): the collection name used by model. If no value are specified, the default value will be used: **schedules**.\n\nUsage\n===================\nCelerybeat-mongo just supports Interval and Crontab schedules.\nSchedules easily can be manipulated using the mongoengine models in celerybeat mongo.models module.\n\nExample creating interval-based periodic task\n---------------------------------------------\n\nTo create a periodic task executing at an interval you must first\ncreate the interval object::\n\n    from celery import Celery\n\n    config = {\n        \"mongodb_scheduler_db\": \"my_project\",\n        \"mongodb_scheduler_url\": \"mongodb://localhost:27017\",\n    }\n\n    app = Celery('hello', broker='redis://localhost//')\n    app.conf.update(**config)\n\n    from celerybeatmongo.models import PeriodicTask\n\n    periodic = PeriodicTask(\n        name='Importing contacts',\n        task=\"proj.import_contacts\"\n        interval=PeriodicTask.Interval(every=10, period=\"seconds\") # executes every 10 seconds.\n    )\n    periodic.save()\n\n.. note::\n\n    You should import celerybeat-mongo just after celery initialization.\n\n\nExample creating crontab periodic task\n---------------------------------------------\n\nA crontab schedule has the fields: minute, hour, day_of_week, day_of_month and month_of_year, so if you want the equivalent of a 30 7 * * 1 (Executes every Monday morning at 7:30 a.m) crontab entry you specify::\n\n\n    from celery import Celery\n\n    config = {\n        \"mongodb_scheduler_db\": \"my_project\",\n        \"mongodb_scheduler_url\": \"mongodb://localhost:27017\",\n    }\n\n    app = Celery('hello', broker='redis://localhost//')\n    app.conf.update(**config)\n\n    from celerybeatmongo.models import PeriodicTask\n\n    periodic = PeriodicTask(name=\"Send Email Notification\", task=\"proj.notify_customers\")\n    periodic.crontab = PeriodicTask.Crontab(minute=\"30\", hour=\"7\", day_of_week=\"1\",\n                               day_of_month=\"0\", month_of_year=\"*\")\n    periodic.save()\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzmap%2Fcelerybeat-mongo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzmap%2Fcelerybeat-mongo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzmap%2Fcelerybeat-mongo/lists"}