Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

server, webui: add pool descriptions #167

Merged
merged 2 commits into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions resallocserver/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,7 @@ def run(self):


class Pool(object):
description = None
max = 4
max_starting = 1
max_prealloc = 2
Expand Down
9 changes: 9 additions & 0 deletions resallocwebui/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from resallocserver.app import session_scope
from resallocserver.logic import QResources
from resallocserver import models
from resallocserver.manager import reload_config
from resalloc.helpers import RState
from resallocwebui import staticdir, templatedir

Expand Down Expand Up @@ -37,12 +38,20 @@ def pools():
# e.g. result["copr_hv_x86_64_01_prod"]["STARTING"]
result = {}

_, pools_from_config = reload_config()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please test that this doesn't break selinux (apache is unable to read resalloc's configuration files)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It had some issues with /var/log/resallocserver/main.log which I fixed with the follow-up commit but surprisingly SELinux has no issues with this (on copr-be-dev)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I probably mixed up :-) SELinux is likely blocking apache to write into main.log.


# Prepare the two-dimensional array, and fill it with zeros
with session_scope() as session:
for pool in session.query(models.Pool).all():
result[pool.name] = dict.fromkeys(columns, 0)
result[pool.name]["MAX"] = pool.max

if pool.name not in pools_from_config:
continue

result[pool.name]["DESCRIPTION"] =\
pools_from_config[pool.name].description

with session_scope() as session:
# Iterate over running resources and calculate how many is starting,
# deleting, etc.
Expand Down
2 changes: 2 additions & 0 deletions resallocwebui/templates/pools.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ <h1 class="resource--title">Resalloc pools</h1>
<thead class="thead-dark">
<tr>
<th scope="col">Pool</th>
<th scope="col">Description</th>
<th scope="col">Max</th>
<th scope="col">Up</th>
<th scope="col">Ready</th>
Expand All @@ -25,6 +26,7 @@ <h1 class="resource--title">Resalloc pools</h1>
{% for pool, info in information.items()|sort(attribute='0') %}
<tr>
<th scope="row">{{ pool }}</th>
<td class="col-sm-4">{{ info['DESCRIPTION'] |default(omit, True) }}</td>
<td>{{ info['MAX'] }}</td>
<td>{{ info['UP'] }}</td>
<td>{{ info['READY'] }}</td>
Expand Down
Loading