stats
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/tag/woodpecker Pipeline was successful

This commit is contained in:
2025-12-15 18:01:49 +01:00
parent 2d48e87893
commit 7f52839877
3 changed files with 8 additions and 68 deletions

View File

@@ -4,15 +4,15 @@ steps:
settings: settings:
repo: ${FORGE_NAME}/${CI_REPO} repo: ${FORGE_NAME}/${CI_REPO}
registry: registry:
from_secret: container_registry from_secret: local_registry
tags: latest,${CI_COMMIT_SHA},${CI_COMMIT_TAG} tags: latest,${CI_COMMIT_TAG}
username: username:
from_secret: container_registry_username from_secret: local_username
password: password:
from_secret: container_registry_password from_secret: local_password
dockerfile: Dockerfile dockerfile: Dockerfile
when: when:
- event: [push, tag] - event: tag
scan: scan:
image: quay.io/wollud1969/woodpecker-helper:0.5.1 image: quay.io/wollud1969/woodpecker-helper:0.5.1
@@ -27,7 +27,7 @@ steps:
from_secret: dtrack_api_url from_secret: dtrack_api_url
commands: commands:
- HOME=/home/`id -nu` - HOME=/home/`id -nu`
- TAG="${CI_COMMIT_TAG:-$CI_COMMIT_SHA}" - TAG="${CI_COMMIT_TAG}"
- | - |
trivy image \ trivy image \
--server $TRIVY_URL \ --server $TRIVY_URL \
@@ -50,7 +50,7 @@ steps:
- event: [push, tag] - event: [push, tag]
deploy: deploy:
image: quay.io/wollud1969/k8s-admin-helper:0.2.1 image: quay.io/wollud1969/k8s-admin-helper:0.4.1
environment: environment:
KUBE_CONFIG_CONTENT: KUBE_CONFIG_CONTENT:
from_secret: kube_config from_secret: kube_config

View File

@@ -12,7 +12,7 @@ from app import app
from app import oidc from app import oidc
@app.route('/pvstats') @app.route('/')
@oidc.require_login @oidc.require_login
def pvstats(): def pvstats():
try: try:
@@ -43,43 +43,6 @@ def pvstats():
) )
graph_html_1 = fig_1.to_html(full_html=False, default_height='30%') graph_html_1 = fig_1.to_html(full_html=False, default_height='30%')
step3_time = time.time()
df = pd.read_sql("SELECT time_bucket('5 minutes', time) AS bucket, AVG(power) AS avg_power FROM pv_power_v WHERE time >= date_trunc('day', now()) - '1 day'::interval AND time < date_trunc('day', now()) GROUP BY bucket ORDER BY bucket", con=engine)
step4_time = time.time()
duration3 = step4_time - step3_time
logger.info(f"{duration3=}")
fig_2 = px.line(df, x='bucket', y='avg_power')
step5_time = time.time()
duration4 = step5_time - step4_time
logger.info(f"{duration4=}")
fig_2.update_layout(
xaxis_title="",
yaxis_title="",
title=f"Export gestern {duration3:.3f}, {duration4:.3f}",
yaxis=dict(ticksuffix=" W")
)
graph_html_2 = fig_2.to_html(full_html=False, default_height='30%')
step6_time = time.time()
df = pd.read_sql("SELECT time_bucket('5 minutes', time) AS bucket, AVG(power) AS avg_power FROM pv_power_v WHERE time >= date_trunc('day', now()) AND time < date_trunc('day', now()) + '1 day'::interval GROUP BY bucket ORDER BY bucket", con=engine)
step7_time = time.time()
duration5 = step7_time - step6_time
logger.info(f"{duration5=}")
fig_3 = px.line(df, x='bucket', y='avg_power')
step8_time = time.time()
duration6 = step8_time - step7_time
logger.info(f"{duration6=}")
fig_3.update_layout(
xaxis_title="",
yaxis_title="",
title=f"Export heute {duration5:.3f}, {duration6:.3f}",
yaxis=dict(ticksuffix=" W")
)
graph_html_3 = fig_3.to_html(full_html=False, default_height='30%')
stepZ_time = time.time()
duration7 = stepZ_time - stepX_time
logger.info(f"{duration7=}")
return render_template_string(f""" return render_template_string(f"""
<html> <html>
<head> <head>
@@ -87,25 +50,6 @@ def pvstats():
</head> </head>
<body> <body>
{graph_html_1} {graph_html_1}
{graph_html_2}
{graph_html_3}
<div style="height:9vh; background-color:lightgrey; font-family: Courier, Consolas, monospace;">
<table style="border-collapse: collapse;">
<style>
td.smallsep {{ padding-right: 10px }}
td.largesep {{ padding-right: 30px }}
</style>
<tr>
<td class="smallsep">Query 1:</td><td class="largesep"> {duration1:.3f} s</td><td class="smallsep">Graph 1:</td><td> {duration2:.3f} s</td>
</tr><tr>
<td class="smallsep">Query 2:</td><td class="largesep"> {duration3:.3f} s</td><td class="smallsep">Graph 2:</td><td> {duration4:.3f} s</td>
</tr><tr>
<td class="smallsep">Query 3:</td><td class="largesep"> {duration5:.3f} s</td><td class="smallsep">Graph 3:</td><td> {duration6:.3f} s</td>
</tr><tr>
<td class="smallsep">Total:</td><td> {duration7:.3f} s</td><td></td><td></td>
</tr>
</table>
</div>
</body> </body>
</html> </html>
""") """)

View File

@@ -5,10 +5,6 @@ from app import app
from app import oidc from app import oidc
@app.route('/')
def index():
abort(404)
@app.route('/generate_image') @app.route('/generate_image')
def generate_image(): def generate_image():
img = Image.new('RGB', (200, 100), color=(255, 255, 255)) img = Image.new('RGB', (200, 100), color=(255, 255, 255))