{"id":21816623,"url":"https://github.com/5monkeys/celery-deduplicate","last_synced_at":"2025-03-21T10:13:30.272Z","repository":{"id":145235212,"uuid":"67489610","full_name":"5monkeys/celery-deduplicate","owner":"5monkeys","description":null,"archived":false,"fork":false,"pushed_at":"2016-12-06T07:01:43.000Z","size":5,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-01-26T06:41:13.281Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/5monkeys.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-09-06T08:34:46.000Z","updated_at":"2024-01-19T10:24:12.000Z","dependencies_parsed_at":null,"dependency_job_id":"4a0f6e2f-46b5-4964-a415-7c4449964ab4","html_url":"https://github.com/5monkeys/celery-deduplicate","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/5monkeys%2Fcelery-deduplicate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/5monkeys%2Fcelery-deduplicate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/5monkeys%2Fcelery-deduplicate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/5monkeys%2Fcelery-deduplicate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/5monkeys","download_url":"https://codeload.github.com/5monkeys/celery-deduplicate/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244776338,"owners_count":20508506,"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-27T15:35:36.571Z","updated_at":"2025-03-21T10:13:30.248Z","avatar_url":"https://github.com/5monkeys.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"==================\ncelery-deduplicate\n==================\n\nAvoids queueing a new task if an identical task is already queued.\n\n-----\nUsage\n-----\n\nThe simples possible case. Uses ``celery.shared_task`` and the default\ndeduplication backend. This example also highlights a case where you would \ntypically not like to deduplicate a task.\n\n.. code-block:: python\n\n    import tempfile\n    from celery_deduplicate import deduplicate_task\n\n\n    @deduplicate_task()\n    def increment_number_in_file(filename):\n        value = int(open(filename).read())\n        new_value = value + 1\n        open(filename).write(new_value)\n\n        return new_value\n\n\n    with tempfile.NamedTemporaryFile() as fd:\n        # Prepare the file\n        fd.write('0')\n        fd.flush()\n\n        first_result = increment_number_in_file.delay(fd.name)\n        second_result = increment_number_in_file.delay(fd.name)\n\n        # They both have the same Task ID\n        assert first_result.id == second_result.id\n\n        # The task only runs once since the second call to\n        # increment_number_in_file.delay() deduplicates the task\n        print('first result, should be 1: {}'.format(first_result.get()))\n        print('second result, should be 1: {}'.format(second_result.get()))\n        print('file contains: {}'.format(open(fd.name).read()))\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F5monkeys%2Fcelery-deduplicate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F5monkeys%2Fcelery-deduplicate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F5monkeys%2Fcelery-deduplicate/lists"}