Skip to content

Commit

Permalink
Improve environment profiles (#51)
Browse files Browse the repository at this point in the history
* added updated config file loading logic to handle resetting environment profiles to the default configuration from the config file

* Developed logic to ensure HELIOS_VERSION remains an uneditable environment variable. Added a check to see if the previously configured HELIOS_VERSION is valid compared to what is loaded on the host machine.

* undo changes to replicate in software specific repo

---------

Co-authored-by: Thomas Arnold <[email protected]>
  • Loading branch information
t-arnold and Thomas Arnold authored Mar 27, 2024
1 parent 2e7f9c6 commit 7f8f729
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion uit/gui_tools/submit.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,4 +422,4 @@ def panel(self):
sizing_mode='stretch_both',
),
sizing_mode='stretch_both',
)
)
11 changes: 7 additions & 4 deletions uit/gui_tools/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ class HpcConfigurable(param.Parameterized):
modules_to_unload = param.ListSelector(default=[])

@param.depends('uit_client', watch=True)
def update_configurable_hpc_parameters(self):
def update_configurable_hpc_parameters(self, reset=False):
if not (self.uit_client and self.uit_client.connected):
return

self.load_config_file()
self.load_config_file(reset=reset)
self.param.modules_to_unload.objects = sorted(self.uit_client.get_loaded_modules())
self.param.modules_to_load.objects = self._get_modules_available_to_load()
self.modules_to_load = self._validate_modules(self.param.modules_to_load.objects, self.modules_to_load)
Expand Down Expand Up @@ -62,7 +62,7 @@ def _validate_modules(self, possible, candidates):
logger.info(f'Module "{m}" is invalid.')
return sorted(modules)

def load_config_file(self):
def load_config_file(self, reset=False):
config_file = Path(self.configuration_file)
if config_file.is_file():
with config_file.open() as f:
Expand All @@ -71,7 +71,10 @@ def load_config_file(self):
if modules:
self.modules_to_load = self.modules_to_load or modules.get('load')
self.modules_to_unload = self.modules_to_unload or modules.get('unload')
self.environment_variables = self.environment_variables or OrderedDict(config.get('environment_variables'))
if reset:
self.environment_variables = OrderedDict(config.get('environment_variables'))
else:
self.environment_variables = self.environment_variables or OrderedDict(config.get('environment_variables'))


class HpcWorkspaces(HpcConfigurable):
Expand Down

0 comments on commit 7f8f729

Please sign in to comment.