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