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

Some config refactoring + minor fixes

parent 846757f8
......@@ -13,12 +13,18 @@ web_url = http://localhost:5000
# Please set the unit: M for Megabyte or G for Gigabyte (-1 without unit to don't set a limit)
max_upload_size = 3G
# Max upload file size for all-vs-all (only target):
# Please set the unit: M for Megabyte or G for Gigabyte (-1 without unit to don't set a limit)
max_upload_size_ava = 1G
# Max upload file size (compressed or not, only for uploaded files, not from URL):
# Please set the unit: M for Megabyte or G for Gigabyte (-1 without unit to don't set a limit)
max_upload_file_size = 1G
[softwares]
minimap2 = ###DEFAULT###
minimap2_cluster = ###DEFAULT###
[debug]
# Debug (enable only for tests)
enable = False
......@@ -49,7 +55,7 @@ min_query_size = 500M
min_target_size = 700M
prepare_script = ###PROGRAM###/bin/all_prepare.py
python3_script = python3
python3_exec = python3
# Max memory:
memory = 32
# Max memory for all-vs-all mode:
......@@ -57,16 +63,11 @@ memory_ava = 32
threads = 4
[softwares]
minimap2 = ###DEFAULT###
minimap2_cluster = ###DEFAULT###
[database]
type = sqlite
url = ###USER###/.dgenies/database.sqlite
# Not used for sqlite:
port =
port = 3306
db =
user =
password =
......@@ -82,9 +83,9 @@ send_mail_status = True
[cron]
### Menage
# Time to launch the cron:
menage_hour = 1h00
clean_time = 1h00
# Frequency (days):
menage_freq = 1
clean_freq = 1
[jobs]
......
......@@ -13,3 +13,4 @@ tendo==0.2.*
matplotlib==2.1.*
drmaa==0.7.*
intervaltree==2.1.*
argparse==1.4
......@@ -242,21 +242,21 @@ class AppConfigReader:
except NoOptionError:
return False
def _get_cron_menage_hour(self):
def _get_cron_clean_time(self):
try:
value = self.reader.get("cron", "menage_hour").lower()
value = self.reader.get("cron", "clean_time").lower()
match = re.match(r"(([0-9])|([0-1][0-9])|(2[0-3]))[hH]([0-5][0-9])", value)
if match is not None:
return [int(match.group(1)), int(match.group(5))]
else:
print("Incorrect menage hour format!")
print("Incorrect clean hour format!")
return [1, 0]
except (NoOptionError, NoSectionError):
return [1, 0]
def _get_cron_menage_freq(self):
def _get_cron_clean_freq(self):
try:
return int(self.reader.get("cron", "menage_freq"))
return int(self.reader.get("cron", "clean_freq"))
except (NoOptionError, NoSectionError):
return 1
......@@ -341,9 +341,9 @@ class AppConfigReader:
except (NoOptionError, NoSectionError):
return self._replace_vars("###PROGRAM###/bin/prepare_data.sh")
def _get_cluster_python_script(self):
def _get_cluster_python_exec(self):
try:
return self._replace_vars(self.reader.get("cluster", "python3_script"))
return self._replace_vars(self.reader.get("cluster", "python3_exec"))
except (NoOptionError, NoSectionError):
return "python3"
......
......@@ -31,22 +31,22 @@ class Crons:
def start_all(self):
self.clear(False)
self.init_menage_cron()
self.init_clean_cron()
self.init_launch_local_cron()
def init_menage_cron(self):
def init_clean_cron(self):
"""
Menage cron is launched at 1h00am each day
Clean cron is launched at 1h00am each day
"""
menage_hour = self.config.cron_menage_hour
menage_freq = self.config.cron_menage_freq
clean_time = self.config.cron_clean_time
clean_freq = self.config.cron_clean_freq
if self.base_dir is not None:
job = self.my_cron.new(sys.executable +
" {0}/bin/clean_jobs.py > {0}/menage.log 2>&1".format(self.config.log_dir),
" {0}/bin/clean_jobs.py > {0}/clean.log 2>&1".format(self.config.log_dir),
comment="dgenies")
job.day.every(menage_freq)
job.hour.on(menage_hour[0])
job.minute.on(menage_hour[1])
job.day.every(clean_freq)
job.hour.on(clean_time[0])
job.minute.on(clean_time[1])
self.my_cron.write()
else:
raise Exception("Crons: base_dir must not be None")
......
......@@ -592,7 +592,7 @@ class JobManager:
"-n", self.query.get_name()]
return self.launch_to_cluster(step="prepare",
batch_system_type=batch_system_type,
command=self.config.cluster_python_script,
command=self.config.cluster_python_exec,
args=args,
log_out=self.logs,
log_err=self.logs)
......
......@@ -175,7 +175,7 @@ def result(id_res):
@app.route("/gallery", methods=['GET'])
def gallery():
return render_template("gallery.html", items=Functions.get_gallery_items(), menu="gallery")
return render_template("gallery.html", items=Functions.get_gallery_items(), menu="gallery", title=app_title)
@app.route("/gallery/<filename>", methods=['GET'])
......
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