Commit 0c90ba78 authored by Floreal Cabanettes's avatar Floreal Cabanettes
Browse files

Fix code refactoring + except on all errors for run job

parent a303cf89
......@@ -111,9 +111,9 @@ def parse_started_jobs():
with Job.connect():
jobs_started = [] # Only local jobs
cluster_jobs_started = [] # Only cluster jobs
jobs = Job.select().where((Job.status == "started") | (Job.status == "starting") | (Job.status == "merging") |
(Job.status == "scheduled-cluster") | (Job.status == "prepare-scheduled") |
(Job.status == "prepare-cluster"))
jobs = Job.select().where((Job.status == "started") | (Job.status == "starting") | (Job.status == "succeed") |
(Job.status == "merging") | (Job.status == "scheduled-cluster") |
(Job.status == "prepare-scheduled") | (Job.status == "prepare-cluster"))
for job in jobs:
pid = job.id_process
if job.batch_type == "local":
......
......@@ -126,7 +126,7 @@ class JobManager:
def check_job_success(self):
if os.path.exists(self.paf_raw):
if os.path.getsize(self.paf_raw) > 0:
return "success"
return "succeed"
else:
return "no-match"
return "fail"
......@@ -262,7 +262,7 @@ class JobManager:
job.save()
else:
self.set_status_standalone(status)
return status == "success"
return status == "succeed"
self.error = self.search_error()
status = "fail"
if MODE == "webserver":
......@@ -404,7 +404,7 @@ class JobManager:
# db.commit()
self.update_job_status(status)
s.deleteJobTemplate(jt)
return status == "success" or status == "prepared"
return status == "succeed" or status == "prepared"
self.update_job_status("fail")
s.deleteJobTemplate(jt)
return False
......@@ -846,6 +846,7 @@ class JobManager:
return False
ptime.write(str(round(time.time())) + "\n")
self.set_job_status("prepared")
if MODE != "webserver":
self.run_job("local")
def _end_of_prepare_dotplot(self):
......@@ -970,6 +971,7 @@ class JobManager:
self.prepare_dotplot_local()
def run_job(self, batch_system_type):
try:
success = False
if batch_system_type == "local":
success = self.__launch_local()
......@@ -1047,6 +1049,10 @@ class JobManager:
job.save()
else:
self.set_status_standalone(status)
except Exception as e:
traceback.print_exc()
self.set_job_status("fail", "Your job has failed for an unexpected reason. Please contact the support if"
"the problem persists.")
if MODE == "webserver" and self.config.send_mail_status:
self.send_mail_post()
......
......@@ -692,6 +692,10 @@ h2.status {
width: 80.4%;
}
.progress-status-bar.succeed {
width: 75.0%;
}
.progress-status-bar.success, .progress-status-bar.fail, .progress-status-bar.no-match {
width: 100%;
}
......
This diff is collapsed.
......@@ -14,7 +14,7 @@
{% block content %}
<h2 class="status">Job name: {{ id_job }}</h2>
<div class="status-body">
{% if status == "started" %}
{% if status == "started" or status == "succeed" %}
<p>Your job has started.<br/>
{% elif status == "starting" %}
<p>Your job is starting...<br/>
......
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