{"id":20503397,"url":"https://github.com/boylegu/celery-task-tigger","last_synced_at":"2025-04-13T20:22:53.365Z","repository":{"id":62561284,"uuid":"59474324","full_name":"boylegu/celery-task-tigger","owner":"boylegu","description":"A controllable timing task widgets with Celery","archived":false,"fork":false,"pushed_at":"2017-06-21T05:40:30.000Z","size":38,"stargazers_count":55,"open_issues_count":0,"forks_count":14,"subscribers_count":10,"default_branch":"master","last_synced_at":"2024-10-14T09:16:51.793Z","etag":null,"topics":["celery","crontab","periodic","python","python3","task"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/boylegu.png","metadata":{"files":{"readme":"README.md","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":"2016-05-23T10:39:18.000Z","updated_at":"2024-07-10T07:57:29.000Z","dependencies_parsed_at":"2022-11-03T15:15:21.459Z","dependency_job_id":null,"html_url":"https://github.com/boylegu/celery-task-tigger","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boylegu%2Fcelery-task-tigger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boylegu%2Fcelery-task-tigger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boylegu%2Fcelery-task-tigger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boylegu%2Fcelery-task-tigger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/boylegu","download_url":"https://codeload.github.com/boylegu/celery-task-tigger/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224834912,"owners_count":17377801,"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":["celery","crontab","periodic","python","python3","task"],"created_at":"2024-11-15T19:31:02.468Z","updated_at":"2024-11-15T19:32:24.624Z","avatar_url":"https://github.com/boylegu.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"celery-task-tigger\n====\n\n[![release](https://img.shields.io/badge/release-0.4-blue.svg)]()\n[![license](https://img.shields.io/badge/license-MIT-blue.svg)]()\n[![celery](https://img.shields.io/badge/celery-3%7C4-brightgreen.svg)]()\n\n\n\n\n\u003cp align=\"center\"\u003e\n  \u003ca href =\"##\"\u003e\u003cimg alt=\"sanic_vue\" src=\"https://github.com/boylegu/celery-task-tigger/blob/master/images/logo.jpg?raw=true\"\u003e\u003c/a\u003e\n\n\u003ch3 align=\"center\"\u003eA controllable timing task widgets with Celery\u003c/h3\u003e\n\n## About\n\nAs is known to all, Celery have a already provides periodic task and it's very perfit. But, Assume this case: After my task was called, I hope it's task can  frequency of execution, and when celery task was started. \n\nThe above case, Periodic task is hard to practice, Becacuse it's depend on celery beat. ``celery-task-tigger`` do it over simple packaging or implement for solution to do it.\n\n\n## Installation\n\n~~~python\npip install celery-task-tigger\n\n~~~\n\n## Useage\n\nAssume you have aleady install celery and can do it.\n\n### Bases\n\nOption `max_times` is must be appoint.\n\n~~~python\nfrom celery_tasktigger.decorator import tigger_task\n\n@app.task(bind=True)\n@tigger_task(max_times='forever')    # forever is expressed unlimited time\ndef add(self, x, y):\n    return x + y\n\n~~~\n\n### max_times\n\nOption `max_times`: The maximum number of execute the task times.\n\nType： ***int***\n\n\u003e Note: The value ***'forever'*** is expressed unlimited time. \n\nExample: \n\n~~~python\n@app.task(bind=True)\n@tigger_task(max_times=3)    # after execute 3 times, raise an exception\ndef add(self, x, y):\n    return x + y\n\n~~~\n\n### countdown\n\nOption `countdown`: You can also provide the countdown argument to execute.\n\nType:  ***int***\n\nDefault: 1 (seconds)\n\nExample: \n\n~~~python\n@app.task(bind=True)\n@tigger_task(max_times='forever', countdown=3)    # each execute in 3 seconds\ndef add(self, x, y):\n    return x + y\n\n~~~\n\nOR\n\n~~~python\n@app.task(bind=True)\n@tigger_task(max_times='forever')    \ndef add(self, x, y, countdown=3):  # you also can define formal parameter in task\n    return x + y\n\n~~~\n\n## How To Calling Task\n\n~~~~python\n\u003e\u003e from example import add\n\u003e\u003e add.apply_async((1,2))\n~~~~\n\nyou can also delayed execute task, as follow：\n\n~~~~python\n\u003e\u003e from example import add\n\u003e\u003e add.apply_async((1,2), countdown=4)   # after 4 seconds, begin start task\n# add.apply_async((1,2),{'countdown': 2} countdown=4)  ## after 4 seconds, begin start task and interval in 2 seconds\n~~~~\n\n\u003e About Celery Task, Please see below for details： \n\u003e [Celery Calling-Tasks Document](http://docs.jinkan.org/docs/celery/userguide/calling.html)\n\n## How To Stop\n\nif you appoint `max_times='forever'` or provides the bigger values of max_times, you must stop it in programe.\n\n~~~~python\n\u003e\u003e result = add.apply_async((1,2))\n\u003e\u003e result.revoke()\n   or\n\u003e\u003e from mycelery import app\n\u003e\u003e app.control.revoke('task_id')\n~~~~\n\n\u003e See below for details： \n\u003e [Celery Document——FAQ](http://docs.jinkan.org/docs/celery/faq.html#can-i-cancel-the-execution-of-a-task)\n\n## Some screenshots\n\n![](http://i1.piimg.com/536217/1ae9af3a274de4c7.gif)\n\n## Features\n\n- 100％ full compatible with Celery 3 | 4\n\n- the frequency of execution for task\n\n- ...and many other stuff (o,0)\n\n\n## Author\n\n- Boyle Gu\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fboylegu%2Fcelery-task-tigger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fboylegu%2Fcelery-task-tigger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fboylegu%2Fcelery-task-tigger/lists"}