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

DoesNotExist('WorkerState matching query does not exist.',) #55

Open
agutierrezrodriguez opened this issue Jan 25, 2018 · 5 comments
Open

Comments

@agutierrezrodriguez
Copy link

We have many of this errors and produced in this code:

    def update_heartbeat(self, hostname, heartbeat, update_freq):
        with transaction.atomic():
            # check if there was an update in the last n seconds?
            interval = Now() - timedelta(seconds=update_freq)
            recent_worker_updates = self.filter(
                hostname=hostname,
                last_update__gte=interval,
            )
            if recent_worker_updates.exists():
                # if yes, get the latest update and move on
                obj = recent_worker_updates.get()
            else:
                # if no, update the worker state and move on
                obj, _ = self.select_for_update_or_create(
                    hostname=hostname,
                    defaults={'last_heartbeat': heartbeat},
                )
        return obj

We have identified the bug in interval line.

Interval is generated in dynamic way (celery_monitor_workerstate.last_update >= ((CURRENT_TIMESTAMP - INTERVAL '60.000000' SECOND_MICROSECOND))) and the query results from recent_worker_updates.exists() and obj = recent_worker_updates.get() is different.

With a fixed interval value, we can avoid this bug.

agutierrezrodriguez added a commit to agutierrezrodriguez/django-celery-monitor that referenced this issue Jan 25, 2018
@agutierrezrodriguez
Copy link
Author

hello...

@agutierrezrodriguez
Copy link
Author

@jezdez are you alive?

@rh0dium
Copy link

rh0dium commented Nov 2, 2018

I'm still getting this was this ever pushed out as a release?

@kedare
Copy link

kedare commented Dec 4, 2018

Nop :/

@rh0dium
Copy link

rh0dium commented Dec 20, 2018

Please Help

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

3 participants