From 833a34a25010a17d33abbeee56078f0d29429b75 Mon Sep 17 00:00:00 2001 From: Theofilos Manitaras Date: Tue, 24 Jul 2018 19:16:42 +0200 Subject: [PATCH 1/3] Fix bug in unloading of conflicting modules * Fix bug which led to accumulation of module unloading. * Use raw string to avoid warnings. --- reframe/core/environments.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/reframe/core/environments.py b/reframe/core/environments.py index c3cc20ae60..d7b7426887 100644 --- a/reframe/core/environments.py +++ b/reframe/core/environments.py @@ -16,7 +16,7 @@ class Environment: to be set when this environment is loaded by the framework. Users may not create or modify directly environments. """ - name = fields.StringPatternField('name', '(\w|-)+') + name = fields.StringPatternField('name', r'(\w|-)+') modules = fields.TypedListField('modules', str) variables = fields.TypedDictField('variables', str, str) @@ -79,11 +79,11 @@ def load(self): if rt.modules_system.is_module_loaded(m): self._preloaded.add(m) - self._conflicted += rt.modules_system.load_module(m, force=True) - for conflict in self._conflicted: + module_conflicts = rt.modules_system.load_module(m, force=True) + self._conflicted += module_conflicts + for conflict in module_conflicts: stmts = rt.modules_system.emit_unload_commands(conflict) self._load_stmts += stmts - self._load_stmts += rt.modules_system.emit_load_commands(m) for k, v in self._variables.items(): From 6043a9f7d03d5818a0c7e423c437fb2275c2ccfb Mon Sep 17 00:00:00 2001 From: Theofilos Manitaras Date: Tue, 24 Jul 2018 22:01:53 +0200 Subject: [PATCH 2/3] Add an empty line for clarity --- reframe/core/environments.py | 1 + 1 file changed, 1 insertion(+) diff --git a/reframe/core/environments.py b/reframe/core/environments.py index d7b7426887..c3258930a7 100644 --- a/reframe/core/environments.py +++ b/reframe/core/environments.py @@ -84,6 +84,7 @@ def load(self): for conflict in module_conflicts: stmts = rt.modules_system.emit_unload_commands(conflict) self._load_stmts += stmts + self._load_stmts += rt.modules_system.emit_load_commands(m) for k, v in self._variables.items(): From f2583c38b324065792c2a5c215dc0d4b9f8d0c72 Mon Sep 17 00:00:00 2001 From: Theofilos Manitaras Date: Wed, 25 Jul 2018 12:09:24 +0200 Subject: [PATCH 3/3] Address PR comments --- reframe/core/environments.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/reframe/core/environments.py b/reframe/core/environments.py index c3258930a7..f3d46460ed 100644 --- a/reframe/core/environments.py +++ b/reframe/core/environments.py @@ -79,13 +79,13 @@ def load(self): if rt.modules_system.is_module_loaded(m): self._preloaded.add(m) - module_conflicts = rt.modules_system.load_module(m, force=True) - self._conflicted += module_conflicts - for conflict in module_conflicts: - stmts = rt.modules_system.emit_unload_commands(conflict) + conflicted = rt.modules_system.load_module(m, force=True) + for c in conflicted: + stmts = rt.modules_system.emit_unload_commands(c) self._load_stmts += stmts self._load_stmts += rt.modules_system.emit_load_commands(m) + self._conflicted += conflicted for k, v in self._variables.items(): if k in os.environ: