Commit e0ad2dc5 authored by Floreal Cabanettes's avatar Floreal Cabanettes
Browse files

Add job type for analytics + fix job status for plot existing map

parent 80becf13
......@@ -134,6 +134,7 @@ if MODE == "webserver":
query_size = IntegerField(null=True)
mail_client = CharField()
batch_type = CharField(max_length=20)
job_type = CharField(max_length=5, default="unknown")
status = CharField(max_length=20, default="unknown")
if not Analytics.table_exists():
......
......@@ -1189,6 +1189,8 @@ class JobManager:
if MODE == "webserver" and self.config.send_mail_status:
self.send_mail_post()
return True
def prepare_dotplot_cluster(self, batch_system_type):
"""
Prepare data if alignment already done: just index the fasta (if index not given), then parse the alignment
......@@ -1232,10 +1234,12 @@ class JobManager:
if success:
if self.query is None:
shutil.copy(self.idx_t, self.idx_q)
self._end_of_prepare_dotplot()
return self._end_of_prepare_dotplot()
elif MODE == "webserver" and self.config.send_mail_status:
self.send_mail_post()
return False
def prepare_dotplot_local(self):
"""
Prepare data if alignment already done: just index the fasta (if index not given), then parse the alignment
......@@ -1261,7 +1265,7 @@ class JobManager:
else:
shutil.copy(self.idx_t, self.idx_q)
self._end_of_prepare_dotplot()
return self._end_of_prepare_dotplot()
def prepare_data(self):
"""
......@@ -1284,9 +1288,13 @@ class JobManager:
with Job.connect():
job = Job.get(Job.id_job == self.id_job)
if job.batch_type == "local":
self.prepare_dotplot_local()
success = self.prepare_dotplot_local()
else:
success = self.prepare_dotplot_cluster(job.batch_type)
if success:
self._set_analytics_job_status("success")
else:
self.prepare_dotplot_cluster(job.batch_type)
self._set_analytics_job_status("fail-all")
else:
self.prepare_dotplot_local()
......@@ -1408,7 +1416,8 @@ class JobManager:
target_size=target_size,
query_size=query_size,
mail_client=job.email,
batch_type=job.batch_type)
batch_type=job.batch_type,
job_type="new" if (self.align is None and self.backup is None) else "plot")
log.save()
def _set_analytics_job_status(self, status):
......
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