Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
MTCMon-Rev
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to JiHu GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Xin-Hao Zhu
MTCMon-Rev
Commits
4cb90a7b
Commit
4cb90a7b
authored
7 months ago
by
Xin-Hao Zhu
Browse files
Options
Downloads
Patches
Plain Diff
Use Response instead of render_template to ensure latest HTML
parent
a8b8caef
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
start_client.py
+8
-3
8 additions, 3 deletions
start_client.py
templates/section-cpu.html
+2
-3
2 additions, 3 deletions
templates/section-cpu.html
templates/section-gpu.html
+2
-3
2 additions, 3 deletions
templates/section-gpu.html
with
12 additions
and
9 deletions
start_client.py
+
8
−
3
View file @
4cb90a7b
from
flask
import
Flask
,
request
,
render_template
import
os
from
flask
import
Flask
,
request
,
Response
from
multiprocessing
import
Process
from
generate_html
import
generate_html
from
utils
import
TOKEN
,
CLIENT_PORT
,
CLIENT_PATH
from
utils
import
TOKEN
,
CLIENT_PORT
,
CLIENT_PATH
,
TEMPLATE_DIR
app
=
Flask
(
__name__
)
@app.route
(
CLIENT_PATH
)
def
get_stat
():
if
request
.
args
.
get
(
"
token
"
)
!=
TOKEN
:
return
"
Unauthorized
"
,
401
return
render_template
(
"
stat.html
"
)
with
open
(
os
.
path
.
join
(
TEMPLATE_DIR
,
"
stat.html
"
),
"
r
"
,
encoding
=
"
utf-8
"
)
as
f
:
html
=
f
.
read
()
return
Response
(
html
,
mimetype
=
"
text/html
"
)
if
__name__
==
"
__main__
"
:
p
=
Process
(
target
=
generate_html
)
...
...
This diff is collapsed.
Click to expand it.
templates/section-cpu.html
+
2
−
3
View file @
4cb90a7b
...
...
@@ -48,7 +48,7 @@
<caption>
Disk Stats:
</caption>
<!-- <thead>
<tr>
<th>Part
ition
</th>
<th>Part</th>
<th>Available (GB)</th>
<th>Usage</th>
</tr>
...
...
@@ -60,13 +60,12 @@
<td>
<div
class=
"usagebar"
>
<span
style=
"width: {{disk['percent']}}%"
></span>
<div>
{{disk['free']}}
</div>
<div>
{{disk['free']}}
GB
</div>
</div>
</td>
<td>
{{disk['percent']}}%
</td>
</tr>
{% endfor %}
</tbody>
</table>
...
...
This diff is collapsed.
Click to expand it.
templates/section-gpu.html
+
2
−
3
View file @
4cb90a7b
...
...
@@ -48,7 +48,7 @@
<caption>
Disk Stats:
</caption>
<!-- <thead>
<tr>
<th>Part
ition
</th>
<th>Part</th>
<th>Available (GB)</th>
<th>Usage</th>
</tr>
...
...
@@ -60,13 +60,12 @@
<td>
<div
class=
"usagebar"
>
<span
style=
"width: {{disk['percent']}}%"
></span>
<div>
{{disk['free']}}
</div>
<div>
{{disk['free']}}
GB
</div>
</div>
</td>
<td>
{{disk['percent']}}%
</td>
</tr>
{% endfor %}
</tbody>
</table>
...
...
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