Commit 9be0877e authored by André Anjos's avatar André Anjos 💬

[many] Use central e-mail facilities everywhere, recommend post-office as a...

[many] Use central e-mail facilities everywhere, recommend post-office as a way to centralize e-mail sending
parent 76165250
......@@ -90,17 +90,6 @@ def _select_splits_for_queue(queue):
return splits_to_consider[:queue.availability()]
@transaction.atomic
def send_experiment_emails():
'''Sends experiment e-mails for experiments that just finished'''
from ..experiments.models import Experiment
qs = Experiment.objects.select_for_update().filter(email_dispatch=True)
for k in qs: k.email()
qs.update(email_dispatch=False)
def schedule():
'''Schedules job splits that can run now, respecting user/queue usage
......
......@@ -131,7 +131,6 @@ def scheduler(request):
activity = request.GET['activity']
if activity in ('both', 'schedule'):
schedule.send_experiment_emails()
splits = schedule.schedule()
if splits:
logger.info("Scheduler assigned %d splits", len(splits))
......
......@@ -234,11 +234,6 @@ class Migration(migrations.Migration):
]
operations = [
migrations.AddField(
model_name='experiment',
name='email_dispatch',
field=models.BooleanField(default=False),
),
migrations.AddField(
model_name='result',
name='cache',
......
......@@ -232,7 +232,6 @@ class Experiment(Shareable):
creation_date = models.DateTimeField(null=True, blank=True, auto_now_add=True)
start_date = models.DateTimeField(null=True, blank=True)
end_date = models.DateTimeField(null=True, blank=True)
email_dispatch = models.BooleanField(default=False)
declaration_file = models.FileField(
storage=DeclarationStorage(),
......@@ -410,7 +409,7 @@ class Experiment(Shareable):
if not is_adding and self._loaded_status != self.status:
if self.status in [Experiment.DONE, Experiment.FAILED]:
self.email_dispatch = True
self.email()
# Invoke the base implementation
super(Experiment, self).save(*args, **kwargs)
......
......@@ -111,7 +111,6 @@ def main(user_input=None):
start = time.time()
logger.debug("Starting scheduler cycle...")
schedule.send_experiment_emails()
schedule.schedule()
duration = time.time() - start
if duration < timing:
......
......@@ -379,14 +379,10 @@ concerning these. We provide only some tips which we consider important:
* E-mail privileges: e-mailing maybe configured as part of the Django_
standard logging facilities or used to report experiment completion and
other platform activity. Not all node types require access to an e-mail
server:
- The web server may send e-mails and needs access to a server
- The scheduler process may send e-mails and needs access to a server
- The worker may send e-mails and needs access to a server
other platform activity. While, by default, all node types have access to
Django the configuration and can potentially send e-mails, it is wiser to
use a Django extension such as Post-office_ to centralize e-mail sending
to one node, avoiding potential spam.
* User processes: user code is run in isolated processes launched by the
children of worker processes. Because the user code process does not
......@@ -581,3 +577,4 @@ page`_.
.. _our gitlab page: https://gitlab.idiap.ch/beat/beat.web/issues
.. _bower: http://bower.io
.. _support: https://www.beat-eu.org/platform/contact/
.. _post-office: https://pypi.python.org/pypi/django-post_office
......@@ -64,5 +64,4 @@ Experiments
Backend
-------
* Add proper e-mail queueing support
* Support for launching user process under a different user name
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment