Skip to content

Commit c97df2b

Browse files
committed
Disable client-initiated vgrid and resource map refresh in vgridman and resman
backends if janitor is enabled since it takes care of all refresh handling.
1 parent 7000ff0 commit c97df2b

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

mig/shared/functionality/resman.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# --- BEGIN_HEADER ---
55
#
66
# resman - manage resources
7-
# Copyright (C) 2003-2021 The MiG Project lead by Brian Vinter
7+
# Copyright (C) 2003-2025 The MiG Project lead by the Science HPC Center at UCPH
88
#
99
# This file is part of MiG.
1010
#
@@ -20,7 +20,8 @@
2020
#
2121
# You should have received a copy of the GNU General Public License
2222
# along with this program; if not, write to the Free Software
23-
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
24+
# USA.
2425
#
2526
# -- END_HEADER ---
2627
#
@@ -41,7 +42,7 @@
4142
from mig.shared.modified import pending_resources_update, pending_vgrids_update
4243
from mig.shared.resource import anon_to_real_res_map
4344
from mig.shared.vgridaccess import user_visible_res_confs, get_resource_map, \
44-
OWNERS, CONF
45+
load_resource_map, CONF, OWNERS
4546

4647
list_operations = ['showlist', 'list']
4748
show_operations = ['show', 'showlist']
@@ -155,7 +156,11 @@ def main(client_id, user_arguments_dict):
155156
logger.info("get vgrid and resource map with caching %s" % caching)
156157
visible_res_confs = user_visible_res_confs(configuration, client_id,
157158
caching)
158-
res_map = get_resource_map(configuration, caching)
159+
# NOTE: prevent refresh if janitor is enabled as it handles all updates
160+
if configuration.site_enable_janitor:
161+
(res_map, _) = load_resource_map(configuration, caching=caching)
162+
else:
163+
res_map = get_resource_map(configuration, caching)
159164
anon_map = anon_to_real_res_map(configuration.resource_home)
160165

161166
# NOTE: use simple pending check if caching to avoid lock during update

mig/shared/functionality/vgridman.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
#
2121
# You should have received a copy of the GNU General Public License
2222
# along with this program; if not, write to the Free Software
23-
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
24+
# USA.
2425
#
2526
# -- END_HEADER ---
2627
#
@@ -40,7 +41,8 @@
4041
from mig.shared.modified import pending_vgrids_update
4142
from mig.shared.useradm import get_full_user_map
4243
from mig.shared.vgrid import vgrid_create_allowed
43-
from mig.shared.vgridaccess import get_vgrid_map, VGRIDS, OWNERS, MEMBERS, SETTINGS
44+
from mig.shared.vgridaccess import get_vgrid_map, load_vgrid_map, MEMBERS, \
45+
OWNERS, SETTINGS, VGRIDS
4446

4547
list_operations = ['showlist', 'list']
4648
show_operations = ['show', 'showlist']
@@ -185,7 +187,11 @@ def main(client_id, user_arguments_dict):
185187

186188
if operation in list_operations:
187189
logger.info("get vgrid map with caching %s" % caching)
188-
vgrid_map = get_vgrid_map(configuration, caching=caching)
190+
# NOTE: prevent refresh if janitor is enabled as it handles all updates
191+
if configuration.site_enable_janitor:
192+
(vgrid_map, _) = load_vgrid_map(configuration, caching=caching)
193+
else:
194+
vgrid_map = get_vgrid_map(configuration, caching=caching)
189195
# NOTE: use simple pending check if caching to avoid lock during update
190196
if caching:
191197
pending_updates = pending_vgrids_update(configuration)

0 commit comments

Comments
 (0)