dgenies icon indicating copy to clipboard operation
dgenies copied to clipboard

D-Genies try to send email when asking for Query fasta file in webserver mode when `send_mail_status = False`

Open pbordron opened this issue 2 years ago • 0 comments

Describe the bug In webserver mode, when asking for Query fasta file, D-Genies try to send an email when send_mail_status = False in configuration file application.properties

127.0.0.1 - - [30/Mar/2022 13:14:39] "POST /get-fasta-query/7Oiu3_20220207162341 HTTP/1.1" 200 -
Exception in thread Thread-46:
Traceback (most recent call last):
  File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.8/threading.py", line 1254, in run
    self.function(*self.args, **self.kwargs)
  File "/.../dgenies/src/dgenies/lib/functions.py", line 319, in sort_fasta
    Functions.send_fasta_ready(mailer, job_name, sample_name, compress)
  File "/.../dgenies/src/dgenies/lib/functions.py", line 266, in send_fasta_ready
    mailer.send_mail([Functions.get_mail_for_job(job_name)], "Job %s - Download fasta" % job_name, message,
  File "/.../dgenies/src/dgenies/lib/mailer.py", line 60, in send_mail
    self._send_async_email(msg)
  File "/.../dgenies/dgenies/src/dgenies/lib/mailer.py", line 33, in _send_async_email
    self.mail.send(msg)
  File "/.../venv/lib/python3.8/site-packages/flask_mail.py", line 491, in send
    with self.connect() as connection:
  File "/.../venv/lib/python3.8/site-packages/flask_mail.py", line 144, in __enter__
    self.host = self.configure_host()
  File "/.../venv/lib/python3.8/site-packages/flask_mail.py", line 158, in configure_host
    host = smtplib.SMTP(self.mail.server, self.mail.port)
  File "/usr/lib/python3.8/smtplib.py", line 255, in __init__
    (code, msg) = self.connect(host, port)
  File "/usr/lib/python3.8/smtplib.py", line 339, in connect
    self.sock = self._get_socket(host, port, self.timeout)
  File "/usr/lib/python3.8/smtplib.py", line 310, in _get_socket
    return socket.create_connection((host, port), timeout,
  File "/usr/lib/python3.8/socket.py", line 808, in create_connection
    raise err
  File "/usr/lib/python3.8/socket.py", line 796, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

To Reproduce Steps to reproduce the behavior:

  1. Launch D-Genies in webserver mode with send_mail_status = False in application.properties file
  2. Go to a result page, do a run if needed.
  3. Click on 'sort contigs' button
  4. Click on 'export' and choose 'Query fasta'
  5. See error on server side

Expected behavior Do not send a email and allow to download the file when ready from result page.

pbordron avatar Mar 30 '22 11:03 pbordron