cameronmaske / celery-once

Celery Once allows you to prevent multiple execution and queuing of celery tasks.
https://pypi.python.org/pypi/celery_once/
BSD 2-Clause "Simplified" License
662 stars 90 forks source link

Remove 'self' kwarg in the case of a bound task #12

Closed brouberol closed 9 years ago

brouberol commented 9 years ago

The repr of a task contains a memory address (ex "<@task: sometask of package:0x7f0211153990>"), that will differ between the task caller and the worker itself. Consequently, the lock will never get removed (until it expires) as the generated keys will differ.

By removing the repr from the lock, only the actual task arguments and keyword arguments are used.

brouberol commented 9 years ago

Some usage example of the bind task attribute, if that's unclear: http://celery.readthedocs.org/en/latest/userguide/tasks.html#retrying

cameronmaske commented 9 years ago

@brouberol Looks great! Wanna rebase this into one commit and I'll merge?

brouberol commented 9 years ago

Done!

coveralls commented 9 years ago

Coverage Status

Coverage decreased (-2.2%) to 95.51% when pulling 22cdab4bec16249559c7bc50039d343f967b2632 on brouberol:master into dbce7508536eb8a2d3184dd2dded42a86357882c on TrackMaven:master.