Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
genotoul-bioinfo
D-GENIES
Commits
2de5cc19
Commit
2de5cc19
authored
Nov 17, 2017
by
Floreal Cabanettes
Browse files
Disable wait for fasta generation on compressed fasta, it's always too long
parent
0ed669d0
Changes
2
Hide whitespace changes
Inline
Side-by-side
lib/functions.py
View file @
2de5cc19
...
...
@@ -198,12 +198,12 @@ class Functions:
if
compress
:
Functions
.
compress
(
fasta_file_o
)
os
.
remove
(
lock_file
)
if
mailer
is
not
None
:
if
mailer
is
not
None
and
not
os
.
path
.
exists
(
lock_file
+
".pending"
)
:
Functions
.
send_fasta_ready
(
mailer
,
job_name
,
sample_name
,
compress
)
@
staticmethod
def
compress_and_send_mail
(
job_name
,
fasta_file
,
index_file
,
lock_file
,
compressed
,
mailer
):
Functions
.
compress
(
fasta_file
)
os
.
remove
(
lock_file
)
index
,
sample_name
=
Functions
.
read_index
(
index_file
)
Functions
.
send_fasta_ready
(
mailer
,
job_name
,
sample_name
,
compressed
)
os
.
remove
(
lock_file
)
srv/main.py
View file @
2de5cc19
...
...
@@ -215,6 +215,8 @@ def build_fasta(id_res):
if
is_sorted
and
not
query_fasta
.
endswith
(
".sorted"
):
# Do the sort
Path
(
lock_query
).
touch
()
if
not
compressed
:
# If compressed, it will took a long time, so not wait
Path
(
lock_query
+
".pending"
).
touch
()
thread
=
threading
.
Timer
(
1
,
Functions
.
sort_fasta
,
kwargs
=
{
"job_name"
:
id_res
,
"fasta_file"
:
query_fasta
,
...
...
@@ -224,7 +226,19 @@ def build_fasta(id_res):
"mailer"
:
mailer
})
thread
.
start
()
return
jsonify
({
"success"
:
True
,
"status"
:
0
,
"status_message"
:
"Started"
})
if
not
compressed
:
i
=
0
time
.
sleep
(
5
)
while
os
.
path
.
exists
(
lock_query
)
and
i
<
2
:
i
+=
1
time
.
sleep
(
5
)
if
os
.
path
.
exists
(
lock_query
):
os
.
remove
(
lock_query
+
".pending"
)
return
jsonify
({
"success"
:
True
,
"status"
:
1
,
"status_message"
:
"In progress"
})
return
jsonify
({
"success"
:
True
,
"status"
:
2
,
"status_message"
:
"Done"
,
"gzip"
:
query_fasta
.
endswith
(
".gz"
)
or
query_fasta
.
endswith
(
".gz.sorted"
)})
else
:
return
jsonify
({
"success"
:
True
,
"status"
:
1
,
"status_message"
:
"In progress"
})
elif
is_sorted
and
os
.
path
.
exists
(
lock_query
):
# Sort is already in progress
return
jsonify
({
"success"
:
True
,
"status"
:
1
,
"status_message"
:
"In progress"
})
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment