-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce Worker.last_seen, worker's last communication with hub
This commit introduces a new attribute, last_seen, onto the Worker model used by hub. This field contains the timestamp for the worker's last XML-RPC call to hub and is kept up-to-date automatically. It is accessible from 'export', which means it appears in the responses to get_worker_info method. The motivation is to improve our ability to monitor workers. Prior to this, no attributes on the model can be used to reliably determine whether a worker is alive, or even whether it truly exists. For example, a worker can have enabled=True, ready=True even if it uses a nonexistent hostname. The time at which a worker last called the hub is a useful signal to determine whether workers are alive, so let's start tracking it. Note that the way this is implemented is quite different from how it would be in other circumstances. In particular, if this were implemented when the model was originally defined, it'd just be another column in the DB. The problem with doing this now is that the last DB schema change was ~5 years ago and I doubt that most kobo-using services have a process in place for running migrations around upgrades. I know this is true at least for Pub. For that reason, the info is maintained using 0-byte state files. This is expected to be compatible with all environments without requiring migrations.
- Loading branch information
Showing
5 changed files
with
82 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters