From 06ef750c2b207a1260b3cdd0bb42fdbff1f66d24 Mon Sep 17 00:00:00 2001 From: Andre Anjos <andre.dos.anjos@gmail.com> Date: Thu, 28 Apr 2016 09:32:36 +0200 Subject: [PATCH] [backend] Add update/updated fields to worker class --- beat/web/backend/migrations/0002_scheduler_addons.py | 10 ++++++++++ beat/web/backend/models.py | 7 +++++++ beat/web/settings/settings.py | 6 ------ 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/beat/web/backend/migrations/0002_scheduler_addons.py b/beat/web/backend/migrations/0002_scheduler_addons.py index 93525606a..ee14da860 100644 --- a/beat/web/backend/migrations/0002_scheduler_addons.py +++ b/beat/web/backend/migrations/0002_scheduler_addons.py @@ -88,6 +88,16 @@ class Migration(migrations.Migration): name='used_memory', field=models.PositiveIntegerField(default=0, help_text=b'In %'), ), + migrations.AddField( + model_name='worker', + name='update', + field=models.BooleanField(default=False, help_text='If this worker state must be updated at the next cycle'), + ), + migrations.AddField( + model_name='worker', + name='updated', + field=models.DateTimeField(auto_now=True, null=True), + ), migrations.AlterField( model_name='queue', name='name', diff --git a/beat/web/backend/models.py b/beat/web/backend/models.py index 503aefa24..f4fbd02ec 100644 --- a/beat/web/backend/models.py +++ b/beat/web/backend/models.py @@ -179,6 +179,13 @@ class Worker(models.Model): default=False, ) + update = models.BooleanField( + help_text=u'If this worker state must be updated at the next cycle', + default=False, + ) + + updated = models.DateTimeField(null=True, auto_now=True) + cores = models.PositiveIntegerField() memory = models.PositiveIntegerField(default=0, help_text='In megabytes') diff --git a/beat/web/settings/settings.py b/beat/web/settings/settings.py index fdf898e70..1b20dddf2 100644 --- a/beat/web/settings/settings.py +++ b/beat/web/settings/settings.py @@ -225,12 +225,6 @@ SCHEDULING_INTERVAL = 5 #seconds # a particular worker will run to verify jobs are not scheduled to itself WORKER_INTERVAL = 5 #seconds -# This is the frequency in seconds, in which the worker will update information -# about its internal state to the database. It is typically larger (much -# larger) than the WORKER_INTERVAL to avoid overloading the database with -# unnecessary requests. -WORKER_STATE_UPDATE = 60 #seconds - # The maximum index split errors control the maximum number of times we can # incur in an index split error condition without cancelling the block # execution altogether. This number, multiplied by the scheduling interval, -- GitLab