Skip to content

Conversation

@bartoldeman
Copy link
Contributor

@bartoldeman bartoldeman commented Feb 1, 2018

Also clean up the Lua generator for this a bit and fix the ignores
of the unloads.
We need to bump the minimum Lmod with TCL depends-on to 7.6.1.
It's then easiest to just not care about 7.6.0, and make 7.6.1 the
minimum supported Lmod for depends_on.
@bartoldeman
Copy link
Contributor Author

Ah Travis can't download env modules 4.0:
Resolving prdownloads.sourceforge.net (prdownloads.sourceforge.net)... 52.85.131.153, 52.85.131.22, 52.85.131.98, ...
Connecting to prdownloads.sourceforge.net (prdownloads.sourceforge.net)|52.85.131.153|:80... connected.
HTTP request sent, awaiting response... 403 Forbidden
2018-03-01 02:04:34 ERROR 403: Forbidden.

we'll try again later then...

@boegel
Copy link
Member

boegel commented Mar 1, 2018

@bartoldeman Seems like SourceForge was having trouble for a while, seems to be fixed now, I've re-triggered the tests.

@easybuilders easybuilders deleted a comment from boegelbot Mar 1, 2018
@easybuilders easybuilders deleted a comment from boegelbot Mar 1, 2018
@easybuilders easybuilders deleted a comment from boegelbot Mar 1, 2018
@boegel boegel added this to the 3.6.0 milestone Mar 14, 2018
@boegel
Copy link
Member

boegel commented Mar 14, 2018

@bartoldeman Please sync with current develop and fix the merge conflict on .travis.yml (should be trivial to resolve)?

'moduleforceunload': [False, 'Force unload of all modules when loading the extension', MODULES],
'moduleloadnoconflict': [False, "Don't check for conflicts, unload other versions instead ", MODULES],
'recursive_module_unload': [False, 'Recursive unload of all dependencies when unloading module', MODULES],
'recursive_module_unload_depends_on' : [False, 'Use depends_on (Lmod 7.6.1+) for dependencies in generated module', MODULES],
Copy link
Member

Choose a reason for hiding this comment

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

@bartoldeman Do you think we need this both as configuration option (--recursive-module-unload-depends-on) as well as an easyconfig parameter (recursive_module_unload_depends_on)?

What use case do you see for latter, i.e. selectively enabling the use of depends_on rather than setting it in the global configuration?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i will check... this simply mirrors recursive_module_unload.
If I check the history it looks like the people in Juelich wanted to only have recursive unloading enabled for toolchain modules, and not for other modules, to avoid loadstorms. I will double check how depends_on behaves for us on toolchain modules (we hide them but obviously easybuild uses them itself).

None, 'store', None),
'recursive-module-unload': ("Enable generating of modules that unload recursively.",
None, 'store_true', False),
'recursive-module-unload-depends-on': ("Use depends_on (Lmod 7.6.1+) for dependencies in all generated modules.",
Copy link
Member

Choose a reason for hiding this comment

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

Should this just be use-depends-on, and then have the help message clarify that this implies that it makes unloading of modules recursive?

lmod_depends_on_min = '7.6.1'
if self.COMMAND in MODULE_VERSION_CACHE:
self.version = MODULE_VERSION_CACHE[self.COMMAND]
self.has_depends_on = (isinstance(self, Lmod) and
Copy link
Member

Choose a reason for hiding this comment

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

I'd go with supports_depends_on rather than has_depends_on

supports_depends_on should be set to False in ModulesTool.__init__

and then in Lmod.__init__ it should be set based on the Lmod version after the super call (don't use isinstance(self, Lmod))


MODULE_VERSION_CACHE[self.COMMAND] = self.version
self.has_depends_on = (isinstance(self, Lmod) and
StrictVersion(self.version) >= StrictVersion(lmod_depends_on_min))
Copy link
Member

Choose a reason for hiding this comment

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

You're setting this twice (but it should be moved to the Lmod class anyway)

# include load statements for retained dependencies
recursive_unload = self.cfg['recursive_module_unload']
if self.cfg['recursive_module_unload_depends_on']:
recursive_unload = 'depends_on'
Copy link
Member

Choose a reason for hiding this comment

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

rather than introducing a magic value for the recursive_unload named argument of load_module, why not add a new named argument use_depends_on?

Copy link
Member

Choose a reason for hiding this comment

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

Also, you should take the build_option into account here (rather than in load_module)?

load_template = self.LOAD_TEMPLATE
# Lmod 7.6.1+ supports depends-on which does this most nicely:
if (build_option('recursive_mod_unload_depends_on') or
recursive_unload == 'depends_on') and modules_tool().has_depends_on:
Copy link
Member

Choose a reason for hiding this comment

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

if depends_on is requested but not supported (supports_depends_on is False), then we should get an error rather than silently ignoring that request?

Copy link
Member

Choose a reason for hiding this comment

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

Taking into account the above, this should become something like:

load_template = self.LOAD_TEMPLATE
if use_depends_on:
    if modules_tool().supports_depends_on:
        load_template = self.LOAD_TEMPLATE_DEPENDS_ON
    else:
        raise EasyBuildError("depends_on statements in generated module are not supported by modules tool")

self.assertFalse(is_loaded_regex.search(toy_module_txt), "Recursive unloading is used: %s" % toy_module_txt)
lastargs = ['--recursive-module-unload']
if self.modtool.has_depends_on:
lastargs.append(lastargs[0]+'-depends-on')
Copy link
Member

Choose a reason for hiding this comment

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

We should not stop testing --recursive-module-unload with recent Lmod versions?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

With this change it tests both, but I renamed the option now.

Now initialized to False by default and only set depending on
version in Lmod.__init__, as suggested by @boegel.
Decouple module-use-depends-on completely from recursive-module-unload,
and change recursive-module-unload-depends-on to module-use-depends-on
as suggested by @boegel.
@bartoldeman
Copy link
Contributor Author

I addressed all comments I believe, except for the easyconfig parameter. I'll double-check depends_on behaviour in toolchain modules before I remove that (see my comment in the review).

@bartoldeman
Copy link
Contributor Author

One could argue that since #2316 the recursive_module_unload easyconfig parameter is no longer needed since the global config no longer causes load storms.

depends_on() seems to work ok. I get funny module lists if I load foss after iomkl but that could be fixed by using e.g. family('linalg') in the OpenBLAS and imkl modules, and family('toolchain') in the toolchain modules. This is not a very common use case though since EB itself doesn't do it, and module swap works ok.

@easybuilders easybuilders deleted a comment from boegelbot Mar 30, 2018
'moduleclass': ['base', 'Module class to be used for this software', MODULES],
'moduleforceunload': [False, 'Force unload of all modules when loading the extension', MODULES],
'moduleloadnoconflict': [False, "Don't check for conflicts, unload other versions instead ", MODULES],
'module_use_depends_on' : [False, 'Use depends_on (Lmod 7.6.1+) for dependencies in generated module '
Copy link
Member

Choose a reason for hiding this comment

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

@bartoldeman I would avoid module_use, since that has a particular meaning (not at all related to depends_on).

How about module_depends_on or use_depends_on?

'check_osdeps': not cmdline_options.ignore_osdeps,
'dry_run': cmdline_options.dry_run or cmdline_options.dry_run_short,
'recursive_mod_unload': cmdline_options.recursive_module_unload,
'mod_use_depends_on': cmdline_options.module_use_depends_on,
Copy link
Member

Choose a reason for hiding this comment

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

same here, avoid mod(ule)_use, since it has a very particular meaning

body.append(load_template)

if (build_option('recursive_mod_unload') or recursive_unload or
load_template == self.LOAD_TEMPLATE_DEPENDS_ON):
Copy link
Member

Choose a reason for hiding this comment

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

no need to wrap this across two lines? looks confusing imho...

else:
load_guard = 'isloaded("%(mod_name)s")'
load_statement = [self.conditional_statement(load_guard, '\n'.join(body), negative=True)]
if build_option('recursive_mod_unload') or recursive_unload:
Copy link
Member

Choose a reason for hiding this comment

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

make this elif?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, it really needs to be else: because of the common load_statement = statement at the bottom.

Copy link
Member

Choose a reason for hiding this comment

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

OK, I overlooked that indeed, thanks or clarifying

'module-naming-scheme': ("Module naming scheme to use", None, 'store', DEFAULT_MNS),
'module-syntax': ("Syntax to be used for module files", 'choice', 'store', DEFAULT_MODULE_SYNTAX,
sorted(avail_module_generators().keys())),
'module-use-depends-on': ("Use depends_on (Lmod 7.6.1+) for dependencies in all generated modules "
Copy link
Member

Choose a reason for hiding this comment

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

same here, I'd go with either --module-depends-on or --use-depends-on

])
self.assertEqual(expected, self.modgen.load_module("mod_name", use_depends_on=True))
init_config(build_options={'mod_use_depends_on': 'True'})
self.assertEqual(expected, self.modgen.load_module("mod_name"))
Copy link
Member

Choose a reason for hiding this comment

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

also check the other case, with self.assertErrorRegex?

@boegel boegel changed the title Support Lmod 7.6+ depends_on via recursive-module-unload-depends-on. support depends_on "load" statements in generated modules via --module-depends-on and module_depends_on easyconfig parameter Mar 31, 2018
@boegel
Copy link
Member

boegel commented Mar 31, 2018

lgtm, thanks for the effort @bartoldeman!

@boegel boegel merged commit 23ebd9f into easybuilders:develop Mar 31, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants