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
c090bc99
Commit
c090bc99
authored
Feb 15, 2018
by
Floreal Cabanettes
Browse files
Merge branch 'master' into win32
parents
0362d2c2
7aa8be74
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/bin/dgenies
View file @
c090bc99
...
...
@@ -8,6 +8,8 @@ from glob import glob
import
time
from
dgenies.config_reader
import
AppConfigReader
from
dgenies.bin.clean_jobs
import
parse_data_folders
,
parse_database
,
parse_upload_folders
import
requests
from
requests.exceptions
import
ConnectionError
runned
=
False
...
...
@@ -86,23 +88,39 @@ def parse_args():
return
None
,
None
def
start_browser
(
host
,
port
):
print
(
"Starting browser..."
)
webbrowser
.
open
(
"http://{0}:{1}"
.
format
(
host
,
port
))
def
start_browser
(
host
,
port
,
app
):
web_url
=
"http://{0}:{1}"
.
format
(
host
,
port
)
status_code
=
-
1
tries
=
0
while
status_code
!=
200
and
tries
<
60
:
try
:
status_code
=
requests
.
get
(
web_url
).
status_code
except
ConnectionError
:
print
(
"pass"
)
status_code
=
500
if
status_code
!=
200
:
time
.
sleep
(
1
)
tries
+=
1
if
app
.
got_first_request
:
print
(
"Starting browser..."
)
webbrowser
.
open
(
web_url
)
else
:
print
(
"App has not started. Cancel run of browser"
)
def
run
(
mode
=
"standalone"
,
debug
=
False
,
host
=
"127.0.0.1"
,
port
=
5000
,
no_crons
=
False
,
no_browser
=
False
):
os
.
environ
[
'DISABLE_CRONS'
]
=
"True"
if
no_crons
else
"False"
if
not
debug
and
not
no_browser
:
thread
=
threading
.
Timer
(
2
,
start_browser
,
kwargs
=
{
"host"
:
host
,
"port"
:
port
})
thread
.
start
()
if
debug
:
os
.
environ
[
'LOGS'
]
=
"True"
from
dgenies
import
launch
app
=
launch
(
mode
=
mode
,
debug
=
debug
)
if
not
debug
and
not
no_browser
:
thread
=
threading
.
Timer
(
1
,
start_browser
,
kwargs
=
{
"host"
:
host
,
"port"
:
port
,
"app"
:
app
})
thread
.
start
()
app
.
run
(
host
=
host
,
port
=
port
,
debug
=
debug
)
...
...
src/dgenies/static/js/dgenies.status.js
View file @
c090bc99
...
...
@@ -2,9 +2,11 @@ if (!dgenies) {
throw
"
dgenies wasn't included!
"
}
dgenies
.
status
=
{};
dgenies
.
status
.
mode
=
"
webserver
"
;
dgenies
.
status
.
init
=
function
(
status
)
{
dgenies
.
status
.
init
=
function
(
status
,
mode
)
{
dgenies
.
status
.
mode
=
mode
;
if
(
status
!==
"
success
"
&&
status
!==
"
done
"
&&
status
!==
"
no-match
"
&&
status
!==
"
fail
"
)
{
dgenies
.
status
.
autoreload
();
}
...
...
@@ -29,6 +31,11 @@ dgenies.status.autoreload = function () {
}
}
setTimeout
(
function
(){
window
.
location
.
replace
(
`?refresh=
${
refresh
}
&count=
${
count
}
`
);
if
(
dgenies
.
status
.
mode
===
"
webserver
"
)
{
window
.
location
.
replace
(
`?refresh=
${
refresh
}
&count=
${
count
}
`
);
}
else
{
window
.
location
.
replace
(
`?refresh=1&count=1`
);
}
},
refresh
*
1000
)
};
src/dgenies/templates/status.html
View file @
c090bc99
...
...
@@ -3,54 +3,32 @@
{{ super() }}
<script
src=
"{{ url_for('static', filename='js/dgenies.status.js') }}"
type=
"text/JavaScript"
></script>
{% endblock %}
{% block onload %}dgenies.status.init('{{ status }}');{% endblock %}
{% block onload %}dgenies.status.init('{{ status
}}', '{{ mode
}}');{% endblock %}
{% block content %}
<h2
class=
"status"
>
Job name: {{ id_job }}
</h2>
<div
class=
"status-body"
>
{% if status == "started" %}
<p>
Your job has started.
<br/>
You will receive an email when it will be finished.
<br/>
Alternatively, you can refresh this page to update status.
</p>
{% elif status == "starting" %}
<p>
Your job is starting...
<br/>
You will receive an email when it will be finished.
<br/>
Alternatively, you can refresh this page to update status.
</p>
{% elif status == "scheduled-cluster" %}
<p>
Your job has been scheduled on the cluster.
<br/>
You will receive an email when it will be finished.
<br/>
Alternatively, you can refresh this page to update status.
</p>
{% elif status == "submitted" or status == "waiting" %}
<p>
Your job has been submitted.
<br/>
You will receive an email when it will be finished.
<br/>
Alternatively, you can refresh this page to update status.
</p>
{% elif status == "getfiles" %}
<p>
Your job has been submitted. We are retrieving data...
<br/>
You will receive an email when it will be finished.
<br/>
Alternatively, you can refresh this page to update status.
</p>
{% elif status == "getfiles-waiting" %}
<p>
Your job has been submitted. We are retrieving data... (waiting for download...)
<br/>
You will receive an email when it will be finished.
<br/>
Alternatively, you can refresh this page to update status.
</p>
{% elif status == "merging" %}
<p>
Your map is done. We are preparing files for visualisation...
<br/>
You will receive an email when it will be finished.
<br/>
Alternatively, you can refresh this page to update status.
</p>
{% elif status == "preparing" or status == "preparing-cluster" %}
<p>
We are preparing data...
<br/>
You will receive an email when it will be finished.
<br/>
Alternatively, you can refresh this page to update status.
</p>
{% elif status == "prepare-scheduled" %}
<p>
We are preparing data... [scheduled]
<br/>
You will receive an email when it will be finished.
<br/>
Alternatively, you can refresh this page to update status.
</p>
{% elif status == "prepared"%}
<p>
Your data are ready to be processed. Your job will be scheduled soon...
<br/>
You will receive an email when it will be finished.
<br/>
Alternatively, you can refresh this page to update status.
</p>
{% elif status == "scheduled" %}
<p>
Your job has been shedulded. It will start soon...
<br/>
You will receive an email when it will be finished.
<br/>
Alternatively, you can refresh this page to update status.
</p>
{% elif status == "success" %}
<p>
Your job was completed successfully.
<br/>
Please
<a
href=
"/result/{{ id_job }}"
>
click here
</a>
to show results.
</p>
...
...
@@ -81,6 +59,14 @@
{% else %}
<p>
This job does not exists!
</p>
{% endif %}
{% if status not in ["success", "no_match", "fail"] %}
{% if mode == "webserver" %}
You will receive an email when it will be finished.
<br/>
Alternatively, you can refresh this page to update status.
</p>
{% else %}
This page will refresh automatically.
</p>
{% endif %}
{% endif %}
</div>
<div
class=
"progress-status"
>
<div
class=
"progress-status-bar {{ status }}"
><div
class=
"inner"
></div></div>
...
...
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