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

Don't ask for compression on standalone mode + fix bug on windows

parent b946b9f3
......@@ -161,7 +161,7 @@ class Functions:
@staticmethod
def sort_fasta(job_name, fasta_file, index_file, lock_file, compress=False, mailer=None):
def sort_fasta(job_name, fasta_file, index_file, lock_file, compress=False, mailer=None, mode="webserver"):
index, sample_name = Functions.read_index(index_file)
is_compressed = fasta_file.endswith(".gz")
if is_compressed:
......@@ -185,7 +185,7 @@ class Functions:
if compress:
Functions.compress(fasta_file_o)
os.remove(lock_file)
if mailer is not None and not os.path.exists(lock_file + ".pending"):
if mode == "webserver" and mailer is not None and not os.path.exists(lock_file + ".pending"):
Functions.send_fasta_ready(mailer, job_name, sample_name, compress)
@staticmethod
......
......@@ -86,6 +86,7 @@ dgenies.result.export.export_fasta = function(compress=false) {
};
dgenies.result.export.ask_export_fasta = function () {
if (dgenies.mode === "webserver") {
let dialog = $("<div>")
.attr("id", "dialog-confirm")
.attr("title", "Gzip?");
......@@ -103,19 +104,23 @@ dgenies.result.export.ask_export_fasta = function () {
width: 500,
modal: true,
buttons: {
"Use default": function() {
$( this ).dialog( "close" );
"Use default": function () {
$(this).dialog("close");
dgenies.result.export.export_fasta(false);
},
"Use Gzip": function () {
$( this ).dialog( "close" );
$(this).dialog("close");
dgenies.result.export.export_fasta(true);
},
Cancel: function () {
$( this ).dialog( "close" );
$(this).dialog("close");
}
}
});
}
else {
dgenies.result.export.export_fasta(false);
}
};
dgenies.result.export.export_association_table = function () {
......
This diff is collapsed.
......@@ -391,16 +391,28 @@ def build_fasta(id_res):
Path(lock_query).touch()
if not compressed or MODE == "standalone": # If compressed, it will took a long time, so not wait
Path(lock_query + ".pending").touch()
index_file = os.path.join(res_dir, "query.idx.sorted")
if MODE == "webserver":
thread = threading.Timer(1, Functions.sort_fasta, kwargs={
"job_name": id_res,
"fasta_file": query_fasta,
"index_file": os.path.join(res_dir, "query.idx.sorted"),
"index_file": index_file,
"lock_file": lock_query,
"compress": compressed,
"mailer": mailer
"mailer": mailer,
"mode": MODE
})
thread.start()
else:
Functions.sort_fasta(job_name=id_res,
fasta_file=query_fasta,
index_file=index_file,
lock_file=lock_query,
compress=compressed,
mailer=None,
mode=MODE)
if not compressed or MODE == "standalone":
if MODE == "webserver":
i = 0
time.sleep(5)
while os.path.exists(lock_query) and (i < 2 or MODE == "standalone"):
......
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