Commit 144b61a6 authored by Floreal Cabanettes's avatar Floreal Cabanettes
Browse files

Try to fix mail

parent 1fe1254e
......@@ -13,13 +13,12 @@ from lib.functions import Functions
import requests
import wget
from jinja2 import Template
from flask_mail import Message
from main import send_async_email
from flask_mail import Message, Mail
class JobManager:
def __init__(self, id_job: str, email: str=None, query: Fasta=None, target: Fasta=None, mailer: "Mail"=None):
def __init__(self, id_job: str, email: str=None, query: Fasta=None, target: Fasta=None, app=None, mailer: Mail=None):
self.id_job = id_job = email
self.query = query
......@@ -43,6 +42,11 @@ class JobManager:
self.idx_t = os.path.join(self.output_dir, "target.idx")
self.logs = os.path.join(self.output_dir, "logs.txt")
self.mailer = mailer = app
def send_async_email(self, msg):
def __check_job_success_local(self):
if os.path.exists(self.paf):
......@@ -96,7 +100,7 @@ class JobManager:
sender=(self.mail_org, self.mail_status) if self.mail_org is not None else self.mail_status,
def __launch_local(self):
......@@ -41,11 +41,6 @@ mail = Mail(app)
app_data = config_reader.get_app_data()
def send_async_email(msg):
with app.app_context():
def get_launched_results():
cookie = request.cookies.get("results")
......@@ -119,7 +114,7 @@ def launch_analysis():
target = Fasta(name=target_name, path=target_path, type_f=file_target_type)
# Launch job:
job = JobManager(id_job, email, query, target, mail)
job = JobManager(id_job, email, query, target, app, mail)
return jsonify({"success": True, "redirect": url_for(".status", id_job=id_job)})
Supports Markdown
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