Register ShutdownBuilder task
Register the task to shutdown the builders by themselves.
+import logging
+
from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _
+log = logging.getLogger(__name__)
+
class Config(AppConfig):
name = 'readthedocs.builds'
@@ -11,3 +15,9 @@ class Config(AppConfig):
from readthedocs.builds.tasks import ArchiveBuilds
from readthedocs.worker import app
app.tasks.register(ArchiveBuilds)
+
+ try:
+ from readthedocsext.builds.tasks import ShutdownBuilder
+ app.tasks.register(ShutdownBuilder)
+ except (ModuleNotFoundError, ImportError):
+ log.info('ShutdownBuilder task could not be imported.')
