Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pampa_web
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Touzet Hélène
pampa_web
Commits
80cf541c
Commit
80cf541c
authored
9 months ago
by
Flissi Areski
Browse files
Options
Downloads
Patches
Plain Diff
Handle no assigments found error page
parent
5c17be8d
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
www/cgi-bin/pampa/render_result.py
+31
-4
31 additions, 4 deletions
www/cgi-bin/pampa/render_result.py
with
31 additions
and
4 deletions
www/cgi-bin/pampa/render_result.py
+
31
−
4
View file @
80cf541c
...
@@ -143,7 +143,7 @@ def assignments_output(run_id, taxo_used, taxo_info, job_name=""):
...
@@ -143,7 +143,7 @@ def assignments_output(run_id, taxo_used, taxo_info, job_name=""):
return
html
return
html
def
write_main_page
(
run_id
,
taxo_used
,
taxo_info
,
job_name
=
None
):
def
write_main_page
(
run_id
,
taxo_used
,
taxo_info
,
no_assignments
,
job_name
=
None
):
"""
Write a HTML page. The result page shown first when the PAMPA analysis is done.
"""
"""
Write a HTML page. The result page shown first when the PAMPA analysis is done.
"""
html
=
""
html
=
""
...
@@ -178,6 +178,9 @@ def write_main_page(run_id, taxo_used, taxo_info, job_name=None):
...
@@ -178,6 +178,9 @@ def write_main_page(run_id, taxo_used, taxo_info, job_name=None):
html
+=
(
assignments_output
(
run_id
,
taxo_used
,
taxo_info
,
job_name
=
job_name
))
html
+=
(
assignments_output
(
run_id
,
taxo_used
,
taxo_info
,
job_name
=
job_name
))
html
+=
(
'
<br>
'
)
html
+=
(
'
<br>
'
)
if
no_assignments
:
html
+=
'
<h4><font color=
"
red
"
>No assignments found</font></h4>
'
# Display assignment thumbnails
# Display assignment thumbnails
#html += ("<iframe src='thumbnails.php' width='100%' height='360'></iframe>")
#html += ("<iframe src='thumbnails.php' width='100%' height='360'></iframe>")
#html += ('<br/>')
#html += ('<br/>')
...
@@ -213,6 +216,22 @@ def gen_trees(run_id, taxo_custom=False):
...
@@ -213,6 +216,22 @@ def gen_trees(run_id, taxo_custom=False):
gen_sub_tree
(
common
.
RESULT_DIR
,
run_id
,
assign
.
replace
(
"
"
,
"
_
"
),
assignment
,
"
#0000FF
"
,
url_json
=
url_json
)
gen_sub_tree
(
common
.
RESULT_DIR
,
run_id
,
assign
.
replace
(
"
"
,
"
_
"
),
assignment
,
"
#0000FF
"
,
url_json
=
url_json
)
def
write_no_results_page
(
run_id
,
job_name
=
None
):
"""
Write a HTML page. The result page shown first when the PAMPA analysis is done.
"""
html
=
""
# Insert HTML header and page head
html
+=
(
open
(
f
"
{
common
.
HTML_PATH
}
/header.php
"
,
"
r
"
).
read
())
html
+=
'
<div class=
"
frametitle
"
><h1 id=
"
title
"
>Pampa</h1></div><div id=
"
center_sup
"
><div class=
"
theme-border
"
style=
"
display:none
"
></div><div id=
"
link_home
"
style=
"
display:inline-block
"
><a href=
"
/
"
class=
"
text_onglet
"
><img src=
"
/Style/icon/home_w.png
"
alt=
"
home_general
"
/></a></div><div class=
"
tabs
"
id=
"
menu_central
"
style=
"
display:inline-block
"
>
'
html
+=
open
(
f
"
{
common
.
HTML_PATH
}
/menu_central.txt
"
,
'
r
'
).
read
()
html
+=
'
</div></div><div id=
"
main
"
><div id=
"
center
"
>
'
html
+=
(
f
'
<h2>Results for job
{
run_id
}{
f
"
(
{
job_name
}
)
"
if job_name else
""
}
</h2>
'
)
html
+=
'
<h4><font color=
"
red
"
>No results</font></h4>
'
open
(
common
.
RESULT_DIR
+
run_id
+
"
/results.php
"
,
"
w
"
).
write
(
html
)
# Main program
# Main program
def
main
():
def
main
():
# Ce script est lancé avec un paramètre : le nom d'un fichier json
# Ce script est lancé avec un paramètre : le nom d'un fichier json
...
@@ -246,6 +265,12 @@ def main():
...
@@ -246,6 +265,12 @@ def main():
else
:
else
:
taxo_file
=
params
[
"
taxo_file
"
]
taxo_file
=
params
[
"
taxo_file
"
]
assignments
=
json
.
load
(
open
(
common
.
RESULT_DIR
+
"
/
"
+
run_id
+
"
/out_
"
+
run_id
+
"
.json
"
))
assignments
=
json
.
load
(
open
(
common
.
RESULT_DIR
+
"
/
"
+
run_id
+
"
/out_
"
+
run_id
+
"
.json
"
))
no_assignments
=
False
if
len
(
assignments
)
==
0
:
no_assignments
=
True
#write_no_results_page(run_id, job_name)
taxo_used
=
False
else
:
taxo_used
=
(
assignments
[
0
][
"
lca
"
]
!=
None
)
taxo_used
=
(
assignments
[
0
][
"
lca
"
]
!=
None
)
del
assignments
del
assignments
...
@@ -256,7 +281,7 @@ def main():
...
@@ -256,7 +281,7 @@ def main():
# usage d'un fichier TXT de log présent le cgi-bin pour suivre l'évolution d'une analyse et début si besoin
# usage d'un fichier TXT de log présent le cgi-bin pour suivre l'évolution d'une analyse et début si besoin
log_tree
=
open
(
"
log.txt
"
,
"
a
"
)
log_tree
=
open
(
"
log.txt
"
,
"
a
"
)
tree_created
=
taxo_used
tree_created
=
taxo_used
if
taxo_used
:
if
no_assignments
!=
True
:
log_tree
.
write
(
"
PAMPA is using a taxonomy. Preparing the tree(s)...
\n
"
)
log_tree
.
write
(
"
PAMPA is using a taxonomy. Preparing the tree(s)...
\n
"
)
try
:
try
:
if
taxo_source
==
"
default_reduced
"
:
if
taxo_source
==
"
default_reduced
"
:
...
@@ -320,6 +345,8 @@ def main():
...
@@ -320,6 +345,8 @@ def main():
# pas d'arbre javascript créé, pas d'affichage sur la page de détails
# pas d'arbre javascript créé, pas d'affichage sur la page de détails
tree_created
=
False
tree_created
=
False
log_tree
.
write
(
f
"
Tree generation failed.
\n
"
)
log_tree
.
write
(
f
"
Tree generation failed.
\n
"
)
else
:
else
:
# pas d'arbre javascript créé, pas d'affichage sur la page de détails
# pas d'arbre javascript créé, pas d'affichage sur la page de détails
tree_created
=
False
tree_created
=
False
...
@@ -337,7 +364,7 @@ def main():
...
@@ -337,7 +364,7 @@ def main():
taxo_info
=
"
default
"
taxo_info
=
"
default
"
else
:
else
:
taxo_info
=
"
no
"
taxo_info
=
"
no
"
write_main_page
(
run_id
,
taxo_used
,
taxo_info
,
job_name
=
job_name
)
write_main_page
(
run_id
,
taxo_used
,
taxo_info
,
no_assignments
,
job_name
=
job_name
)
main
()
main
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment