Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pycalibration
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
calibration
pycalibration
Commits
ad7845cf
Commit
ad7845cf
authored
5 years ago
by
Mikhail Karnevskiy
Browse files
Options
Downloads
Patches
Plain Diff
Add dark overview
parent
f0f85334
No related branches found
No related tags found
1 merge request
!180
Add dark overview
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
webservice/serve_overview.py
+40
-0
40 additions, 0 deletions
webservice/serve_overview.py
webservice/serve_overview.yaml
+2
-1
2 additions, 1 deletion
webservice/serve_overview.yaml
webservice/templates/dark_overview.html
+34
-0
34 additions, 0 deletions
webservice/templates/dark_overview.html
with
76 additions
and
1 deletion
webservice/serve_overview.py
+
40
−
0
View file @
ad7845cf
...
@@ -3,6 +3,7 @@ import glob
...
@@ -3,6 +3,7 @@ import glob
import
os
import
os
import
sqlite3
import
sqlite3
from
collections
import
OrderedDict
from
collections
import
OrderedDict
from
datetime
import
datetime
,
timezone
from
http.server
import
BaseHTTPRequestHandler
,
HTTPServer
from
http.server
import
BaseHTTPRequestHandler
,
HTTPServer
from
subprocess
import
check_output
from
subprocess
import
check_output
from
uuid
import
uuid4
from
uuid
import
uuid4
...
@@ -158,6 +159,45 @@ class RequestHandler(BaseHTTPRequestHandler):
...
@@ -158,6 +159,45 @@ class RequestHandler(BaseHTTPRequestHandler):
self
.
wfile
.
write
(
bytes
(
message
,
"
utf8
"
))
self
.
wfile
.
write
(
bytes
(
message
,
"
utf8
"
))
return
return
if
"
dark?
"
in
self
.
path
:
# Send headers
self
.
send_header
(
'
Content-type
'
,
'
text/html
'
)
self
.
end_headers
()
host
=
config
[
"
server-config
"
][
"
host
"
]
port
=
config
[
"
server-config
"
][
"
port
"
]
reports
=
{}
for
instrument
,
detectors
in
cal_config
[
'
dark
'
].
items
():
reports
[
instrument
]
=
{}
for
detector
in
detectors
:
det_inset
=
detector
.
replace
(
'
-
'
,
'
_
'
)
tmpl
=
'
/gpfs/exfel/exp/{}/*/*/usr/dark/*/{}
'
.
format
(
instrument
,
det_inset
)
files
=
glob
.
glob
(
tmpl
+
'
/*pdf
'
)
files
+=
glob
.
glob
(
tmpl
+
'
/*/*pdf
'
)
files
.
sort
(
key
=
os
.
path
.
getmtime
)
file_info
=
[]
for
i
,
file
in
enumerate
(
files
):
if
'
xfel.pdf
'
in
file
:
continue
if
(
i
%
2
)
==
0
:
bgcolor
=
'
EEEEEE
'
else
:
bgcolor
=
'
FFFFFF
'
time
=
os
.
stat
(
file
).
st_mtime
d_time
=
datetime
.
fromtimestamp
(
time
).
replace
(
tzinfo
=
timezone
.
utc
)
s_time
=
d_time
.
strftime
(
'
%y-%m-%d %H:%M
'
)
file_info
.
append
([
file
,
s_time
,
bgcolor
])
reports
[
instrument
][
detector
]
=
file_info
tmpl
=
Template
(
self
.
templates
[
"
dark-overview
"
])
message
=
tmpl
.
render
(
reports
=
reports
,
host
=
host
,
port
=
port
)
self
.
wfile
.
write
(
bytes
(
message
,
"
utf8
"
))
return
# Send headers
# Send headers
self
.
send_header
(
'
Content-type
'
,
'
text/html
'
)
self
.
send_header
(
'
Content-type
'
,
'
text/html
'
)
self
.
end_headers
()
self
.
end_headers
()
...
...
This diff is collapsed.
Click to expand it.
webservice/serve_overview.yaml
+
2
−
1
View file @
ad7845cf
...
@@ -6,6 +6,7 @@ templates:
...
@@ -6,6 +6,7 @@ templates:
running-jobs
:
./templates/running_jobs.html
running-jobs
:
./templates/running_jobs.html
request-dark
:
./templates/request_dark.html
request-dark
:
./templates/request_dark.html
checkbox
:
./templates/checkbox.html
checkbox
:
./templates/checkbox.html
dark-overview
:
./templates/dark_overview.html
css
:
./templates/serve_overview.css
css
:
./templates/serve_overview.css
shell-commands
:
shell-commands
:
...
@@ -49,4 +50,4 @@ server-config:
...
@@ -49,4 +50,4 @@ server-config:
web-service
:
web-service
:
job-db
:
./webservice_jobs.sqlite
job-db
:
./webservice_jobs.sqlite
cal-config
:
/home/karnem/myscratch/calibration3/calibration_configurations/default.yaml
cal-config
:
/home/karnem/myscratch/calibration3/calibration_configurations/default.yaml
\ No newline at end of file
This diff is collapsed.
Click to expand it.
webservice/templates/dark_overview.html
0 → 100644
+
34
−
0
View file @
ad7845cf
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<link
rel=
"stylesheet"
href=
"serve_overview.css"
>
<title>
Overview of dark runs
</title>
</head>
<body>
<div
class=
"block"
>
<h1>
Dark runs
</h1>
{% for instrument, detectors in reports.items() %}
<h2>
{{ instrument }}
</h2>
{% for detector, files in detectors.items() %}
<h3>
{{ detector }}
</h3>
<table>
{% for file in files %}
<tr
bgcolor=
"{{ file[2] }}"
>
<td>
<a
href=
http://{{host}}:{{port}}/file?{{
file
[0]
}}
target=
"_blank"
>
{{ file[0] }}
</a>
</td>
<td>
{{ file[1] }}
</td>
</tr>
{% endfor %}
</table>
<br>
{% endfor %}
<br>
{% endfor %}
</div>
</body>
</html>
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