Skip to content

quick fix so module dependencies get automatically unloaded when doing "module unload"#830

Merged
boegel merged 45 commits intoeasybuilders:developfrom
pescobar:modules-unload-deps
Feb 11, 2014
Merged

quick fix so module dependencies get automatically unloaded when doing "module unload"#830
boegel merged 45 commits intoeasybuilders:developfrom
pescobar:modules-unload-deps

Conversation

@pescobar
Copy link
Member

I don't know if you are interested in this "feature". I do the PR just in case so you can decide about it

You can read details about this here:
#714 (comment)

fgeorgatos and others added 9 commits December 22, 2013 16:39
Signed-off-by: Fotis Georgatos <fotis.georgatos@uni.lu>
Signed-off-by: Fotis Georgatos <fotis.georgatos@uni.lu>
Signed-off-by: Fotis Georgatos <fotis.georgatos@uni.lu>
Signed-off-by: Fotis Georgatos <fotis.georgatos@uni.lu>
Signed-off-by: Fotis Georgatos <fotis.georgatos@uni.lu>
Signed-off-by: Fotis Georgatos <fotis.georgatos@uni.lu>
Signed-off-by: Fotis Georgatos <fotis.georgatos@uni.lu>
@hpcugentbot
Copy link

Automatic reply from Jenkins: Can I test this?

@JensTimmerman
Copy link

Jenkins: ok to test

@stdweird
Copy link
Contributor

@JensTimmerman @boegel as this changes current behaviour, shouldn't this come with an option to turn on/off?

@JensTimmerman
Copy link

@stdweird agreed,
@pescobar Can you look into adding a configuration option for this (We can make it default in EasyBuild 2.0, since it's a nice feature to have if it works as advertised) ?

Please also add a unit test for this option (The current one fails, and with reason, it changed behaviour)

@boegel
Copy link
Member

boegel commented Feb 8, 2014

@pescobar: Yes, since this changes default behavior, so we need an option to enable this.
We discussed this offline over beers, and you agreed that this automagic unloading shouldn't be the default anyway (I hope you remember ;-)).

To add an option, see easybuild/tools/options.py (see override_options for this specifically).

You will then need to add a build_options entry for this new option, to pass it down to EasyBlock.

Once that is done, pass this build option down to the self.moduleGenerator.load_module method used a named argument (e.g. name it auto_unload_deps), which is called in the make_module_dep in easybuild/framework/easyblock.py, and act on it (only encapsulate in quotes when auto_unload_deps is enabled).
You probably want to make a similar change for unload_module.

Make sure that this is very well documented (with comments in load_module and unload_module), because it still baffles me that simply using single quotes around the module name have this kind of effect.

If you add a new option, make sure it gets unit tested. You'll need to add a new test to test/framework/options.py. You can use one of the tests that's already there for inspiration, maybe test_tmpdir is a good one.

Let us know if you need any help with this. I'll tag this PR for EB v1.12, since this'll need some work before it's ready to be merged in.

@rtmclay: Is it a common feature of module tools to automatically unload dependency modules on an unload if the module name is encapsulated in single quotes in the is-loaded conditional?

@rtmclay
Copy link

rtmclay commented Feb 8, 2014

I'm not quite sure what you are asking. With Lmod, you must wrap the call with mode() because unloading a module file while unloading another module doesn't make sense. How do you reverse an unload?

 if (mode() =="load") then
     unload("foo")
 end

You can always unload a module even if it is not loaded. That is it is not an error to try to unload a module that is not loaded.

But maybe that is not the question you are asking. If you have a module FOO:

load("BAR")

If you load FOO, then BAR will be loaded. If you unload FOO then BAR will be unloaded.

Have I answered your question?

@boegel
Copy link
Member

boegel commented Feb 9, 2014

@rtmclay: The way we have been generating module files is such that unloading a module does not trigger unloading of dependencies. One major reason there is toolchains that are loaded as modules as well, so as soon as you have two separate modules loaded, unloading one of them will probably break the functionality of the other (since the toolchain will be unloaded).

In Tcl modules, you can specify conditional loads in two ways:

(i) one that triggers unloading (when the module name is wrapped in quotes)

if { ![is-loaded 'foo/1.2.3'] } {
    module load foo/1.2.3
}

(ii) one that doesn't trigger unloading (no single quotes)

if { ![is-loaded foo/1.2.3] } {
    module load foo/1.2.3
}

Does Lmod support both ways?

@rtmclay
Copy link

rtmclay commented Feb 9, 2014

Lmod always requires quotes.

if (not isloaded("foo/1.2.3")) then
load("foo/1.2.3")
end

Without quotes, Lua would treat them as variables. You could do:

mfile="foo/1.2.3"
if (not isloaded(mfile)) then
load(mfile)
end

In the above case mfile is a variable and "mfile" is a string.

boegel and others added 22 commits February 10, 2014 08:54
properly parse dependencies in easyconfig format v2
…eorgatos/easybuild-framework into 800_contrib_built-banner-andor-footer

Conflicts:
	easybuild/tools/repository.py
update with develop (to fix conflict), finish implementation of --modules-footer and add unit test for it
…-banner-andor-footer

800 contrib built banner and/or footer
make generating recursive unloading modules configurable (and non-default)
don't include 'if is-loaded' guard when recursive module unloading is requested
@boegel
Copy link
Member

boegel commented Feb 10, 2014

Jenkins: test this please

@pescobar
Copy link
Member Author

@boegel I have tried this and its working fine for me. When using --recursive-module-unload the modulefiles are generated without the "if is-loaded" sentence for the dependencies and it unload dependencies when doing unload (Lmod 5.2)

@boegel
Copy link
Member

boegel commented Feb 11, 2014

Jenkins is happy, and thus so am I.

Thanks for initiating and testing this @pescobar!

boegel added a commit that referenced this pull request Feb 11, 2014
quick fix so module dependencies get automatically unloaded when doing "module unload"
@boegel boegel merged commit ecd44c5 into easybuilders:develop Feb 11, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants