Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1 Running, 1 Queued (per set of keys) #114

Open
claytondaley opened this issue Jan 23, 2020 · 0 comments
Open

1 Running, 1 Queued (per set of keys) #114

claytondaley opened this issue Jan 23, 2020 · 0 comments

Comments

@claytondaley
Copy link

claytondaley commented Jan 23, 2020

EDIT: replaced "bucket" with segment since it's a group unified by a key but not a fixed number of "buckets" as the term would normally be used

The "toy" case on the need for 1 running and 1 queued goes something like... assume we're updating a standard deviation field for a specific segment of values:

  • We add a value to the DB
  • We queue that segment for calculation
  • The task starts and loads the segment (and starts work)
  • We add a value to the DB
  • We try to queue the segment (but celery-once blocks it)
  • The task finishes (without incorporating the latest value)

If we don't queue a second copy when we add the new value, the stdef ends up out of date. The "1 running" limitation is due to the nature of the task -- which is not idempotent (and can't be made so).

It sounds like:

However, the documentation on unlock_before_run states "any retry of the task won't re-enable the lock" and #26 calls retry. Together it sounds like this will put an arbitrary number of tasks into the retry queue. Does my analysis sound right so far?

Is there some reason we can't/shouldn't wrap the retry call to attempt to restore the lock (or raise/quit, preventing duplicates in the queue) if unlock_before_run is configured?

@claytondaley claytondaley changed the title 1 Running, 1 Queued 1 Running, 1 Queued (per set of keys) Jan 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant