Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Easyconfig: allow configs to be overridden with env vars #712

Closed
wants to merge 2 commits into from

Conversation

wpoely86
Copy link
Member

@wpoely86 wpoely86 commented Oct 7, 2013

Based on the discussion in #700

It's possible to override an Easyconfig option with an environment
variable. The name should follow EB_EC_PARAM__, for
example: EB_EC_PARAM_ZLIB_HOMEPAGE. Options can be strings, list and
dicts. Specify like:
EB_EC_PARAM_ZLIB_PATCHES="file1:file2"
EB_EC_PARAM_ZLIB_TOOLCHAINOPTS="pic=False:optarch=True"
EB_EC_PARAM_ZLIB_HOMEPAGE="www.somesite.com"

@boegel, @fgeorgatos please have a look.

Currently, only EB specific overrides are possible. Something like EB_EC_PARAM_MAXPARALLEL would make sense but EB_EC_PARAM_NAME doesn't. Do we allow a limited set of general options? In principle, all options can be general, only name would give problems (I think).

It's possible to override an Easyconfig option with an environment
variable. The name should follow EB_EC_PARAM_<eb name>_<config>, for
example: EB_EC_PARAM_ZLIB_HOMEPAGE. Options can be strings, list and
dicts. Specify like:
EB_EC_PARAM_ZLIB_PATCHES="file1:file2"
EB_EC_PARAM_ZLIB_TOOLCHAINOPTS="pic=False:optarch=True"
EB_EC_PARAM_ZLIB_HOMEPAGE="www.somesite.com"
@fgeorgatos
Copy link
Collaborator

reviewed and very nice!

I really like snippets of code that give good orthogonality and have immense potential reuse across different cases!

@stdweird
Copy link
Contributor

stdweird commented Oct 7, 2013

(@wpoely86 i can be a bit direct sometimes, don't take this personal. you have been contributing great stuff lately, much appreciated)

a few remarks:
a. part of this needs to be addressed as part of the format v2 spec (eg lets not reinvent a parser; also a list as comma or colon separated, the parsing of these values should not be done here)
b. what you are trying to do is better addressed in more generalised way, by extending the options or as derivative from formatv2.
as part of the regular commandline option it will allow documentation for the options and more importantly, value checking. eg the True/False in your example is not converted to boolean in the code. ideally, this is possible for the easyconfig file, but this is a lot of work, and part of it could be in formatv2, but i'm not sure this is high-priority.

but finally, someone still needs to explain me what problem is being solved here (really, the homepage as an environment variable? what's next, the content of the patchfiles?), and how to avoid the new one created, the cleanup of variables to garantee a clean build environment (to make it reproducable).

something is clearly annoying users, i'd like to understand what.

@fgeorgatos
Copy link
Collaborator

Hi Stijn,

speaking for myself, I had commented at some point in #700 something like:

+1, really like the direction this is taking; giving control externally, will allow more easy tuning
via configuration management or modules, without forcing to hack the defaults.

ie. OK, the homepage wasn't the most convincing example but the general idea to be able
to tune EC contents externally is indeed pretty good and even partly addresses #544,
for certain cases of tuning (eg. on our side notably the tuning of MPI stacks).

In fact, OpenMPI requires some patching for us (so the above idea gets a hit),
meanwhile the rest of MPI stacks, TotalView etc get treated with something of the type:

modextravars = {"HYDRA_LAUNCHER_EXEC": "oarsh", "HYDRA_IFACE": "ib0"}

So, if EB_EC_PARAM_MPICH_MODEXTRAVARS can indeed be set as described above,
this for us is useful. I actually applause how generic is the mechanism for just 20 lines of code!

ps.
We indeed had this item to be discussed in the never-to-happen summer2013 hackathon
(does anyone know what happened to the agenda of that one? it would be relevant here)

@stdweird
Copy link
Contributor

stdweird commented Oct 7, 2013

so a more realistic use case would be: you install EasyBuild latest and greatest and want to run eg eb DOLFIN.eb --robot, but change something for eg zlib or some mpi.
a first generalisation would be to use a config file like eg

[zlib]
patches=file1,file2
toolchainopts=pic:False,optarch:True
webiste=someotherwebsitethatpointstozlibbutthatisnnotzlibsomehow

[mpich]
modextravars=HYDRA_LAUNCHER_EXEC:oarsh,HYDRA_IFACE:ib0

and you want this also in environment variables and maybe also commandline, and it all has to make sense (eg typo checker).

welll, it will depend a bit on the parser in v2. if that one is extended to more keys, it should be not that hard.

@fgeorgatos
Copy link
Collaborator

what is the most important feature, from my biased PoV, is the ability to benefit from upstream patches (eg. by somebody improving on the configopts of OpenMPI), yet still retaining the additional tuning that is required in a certain HPC environment (for some it may be the ssh transport, for some others the queueing platform, for some more the arch etc)

Granted, not everything is possible, but the ability to reduce the long list on our side to just a subset of exceptions, would be of great value:

fgeorgatos@access:~: $ ls -las /home/users/sw/uni.lu-customizations/
total 128
4 drwxr-xr-x  3 sw clusterusers 4096 Oct  6 01:13 .
8 drwxr-xr-x 48 sw clusterusers 4096 Oct  7 15:27 ..
4 -rw-r--r--  1 sw clusterusers  875 Jun 20 10:51 GIMPS-p95v279.linux64.eb
4 -rw-r--r--  1 sw clusterusers  742 Jul 16 02:23 impi-4.0.0.028-32bit.eb
4 -rw-r--r--  1 sw clusterusers  705 Jul 16 02:24 impi-4.0.0.028.eb
4 -rw-r--r--  1 sw clusterusers  745 Jul 16 02:24 impi-4.0.2.003.eb
4 -rw-r--r--  1 sw clusterusers  704 Jul 16 02:24 impi-4.1.0.027.eb
4 -rw-r--r--  1 sw clusterusers  704 Jul 16 02:24 impi-4.1.0.030.eb
4 -rw-r--r--  1 sw clusterusers  704 Jul 16 02:24 impi-4.1.1.036.eb
4 -rw-r--r--  1 sw clusterusers  771 May  3 00:24 MATLAB-2013a.eb
4 -rw-r--r--  1 sw clusterusers  874 Sep 20 16:31 MPICH-3.0.3-ClangGCC-1.1.3.eb
4 -rw-r--r--  1 sw clusterusers  733 May  2 17:17 MVAPICH2-1.7-GCC-4.6.3.eb
4 -rw-r--r--  1 sw clusterusers  934 May  2 17:17 MVAPICH2-1.7-GCC-4.6.3-hwloc-chkpt.eb
4 -rw-r--r--  1 sw clusterusers  528 May  2 17:17 MVAPICH2-1.8.1-GCC-4.7.2.eb
4 -rw-r--r--  1 sw clusterusers  457 Oct  6 01:10 MVAPICH2-1.9-ClangGCC-1.1.3.eb
4 -rw-r--r--  1 sw clusterusers  457 Oct  6 01:10 MVAPICH2-1.9-ClangGCC-1.2.3.eb
4 -rw-r--r--  1 sw clusterusers  461 Oct  6 01:10 MVAPICH2-1.9-GCC-4.7.3.eb
4 -rw-r--r--  1 sw clusterusers  737 Oct  6 01:10 MVAPICH2-1.9-iccifort-2011.13.367.eb
4 -rw-r--r--  1 sw clusterusers 1367 May  3 00:12 OpenMPI-1.4.5-GCC-4.6.3.eb
4 -rw-r--r--  1 sw clusterusers 1255 Jun  3 07:59 OpenMPI-1.4.5-GCC-4.6.3-no-OFED.eb
4 -rw-r--r--  1 sw clusterusers 1988 May  3 01:12 OpenMPI-1.6.3-iccifort-2011.13.367.eb
4 -rw-r--r--  1 sw clusterusers 1919 May  3 00:12 OpenMPI-1.6.4-ClangGCC-1.1.3.eb
4 -rw-r--r--  1 sw clusterusers 1914 May  3 00:12 OpenMPI-1.6.4-GCC-4.6.4.eb
4 -rw-r--r--  1 sw clusterusers 1914 May  3 00:12 OpenMPI-1.6.4-GCC-4.7.2.eb
4 -rw-r--r--  1 sw clusterusers 1713 Oct  6 01:13 OpenMPI-1.6.5-GCC-4.8.1.eb
4 -rw-r--r--  1 sw clusterusers 1534 Oct  6 01:13 OpenMPI-1.6.5-GCC-4.8.1-no-OFED.eb
4 -rw-r--r--  1 sw clusterusers 1646 May  3 00:55 TotalView-8.11.0-0-linux-x86-64.eb
4 -rw-r--r--  1 sw clusterusers 1651 May  3 00:56 TotalView-8.11.0-2-linux-x86-64.eb
4 -rw-r--r--  1 sw clusterusers 1651 Aug 12 19:33 TotalView-8.12.0-0-linux-x86-64.eb

In fact, the ideas of fat easyconfigs & this PR together make it fairly elegant to meet the need.

ps.
In the meantime, I even thought of one use-case with a valid homepage example:
EB_EC_PARAM_GROMACS_HOMEPAGE=http://eniac.cyi.ac.cy/display/UserDoc/GROMACS
(in fact, somebody had been asking it over here, if it was possible to override that for EasyDoc purposes!)

@stdweird
Copy link
Contributor

stdweird commented Oct 8, 2013

can you post a diff of your .eb with the released ones? just to get an idea what needs customisation.

and i don't think your gromacs website url example is valid. it does not point to the gromacs website, only to some documentation. however, it makes a lot of sense to introduce a parameter in the easyconfigs to hold a (list of) urls with relevant documentation/usage examples/... for the software that ios being installed.
sharing that would be a great step forward to easydoc!

@wpoely86
Copy link
Member Author

wpoely86 commented Oct 8, 2013

@stdweird I have no knowledge about the v2 format/parser so I can't comment on any of that. But you are correct that this code is too limited (the true/false is a good point).

I would find it useful to quickly change something, like a toolchain option. And things like EB_EC_PARAM_MAXPARALLEL are interesting.

@fgeorgatos
Copy link
Collaborator

Furthermore, I happened to pass today around this easyconfig and here is a good example why the offered code can reduce effort elsewhere:
https://github.com/hpcugent/easybuild-easyconfigs/blob/master/easybuild/easyconfigs/m/MATLAB/MATLAB-2012b.eb#L16

@stdweird
Copy link
Contributor

stdweird commented Oct 9, 2013

the problem with this sort of code is that EB has no control over it, and thus can not check anything (is it set or not?) nor produce help to see what can be set.
this sort of code will not be allowed in formatv2, n=but it's very clear we will need to provide an alternative via either site specific "global" easyconfig confgfile and/or environemnt variables.

@fgeorgatos
Copy link
Collaborator

@stdweird: I have amended now #544 with the customization examples you asked (there are some more we do here, such as for MATLAB tuning but they don't add up much more, as regards this discussion). It is AS-IS, with the human divergence included, to prove the need for these two issues to get addressed ;-)

Notice that different OpenMPI stacks (1.4.5 vs 1.6.x varieties) may require different patchfiles, therefor the variable approach is interesting because someone could script that externally, meanwhile the [openmpi] style approach could work if you can specify versions.

What is more tricky is: how could we generalize the patchsets etc., for all users on a system?
(ie. can you deliver the diffs automatically to your userbase? with env. vars might have a way to help that,
eg. when your users prefer easyconfigs mpi stacks customization to be done on their own etc)

@hpcugentbot
Copy link

Automatic reply from Jenkins: Can I test this?

@boegel
Copy link
Member

boegel commented Nov 7, 2013

ok to test

self[new_config] = os.environ[env_var].split(os.pathsep)
elif isinstance(self[new_config], dict):
try:
self[new_config] = {x.split('=')[0] : x.split('=')[1] for x in os.environ[env_var].split(os.pathsep)}
Copy link
Contributor

Choose a reason for hiding this comment

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

There is no dict comprehension in python 2.4

@fgeorgatos
Copy link
Collaborator

hi,

i'm more and more convinced about the need of this PR;
this morning @besserox bugged me to add the following to mvapich stacks:
configopts = 'SSH_CMD="/usr/bin/oarsh" ' # affects mpirun_rsh launcher execution
on top of the existing
modextravars = {"HYDRA_LAUNCHER_EXEC": "oarsh"} # affects Hydra launcher execution

Having the feature would allow to have one more path to integrate easybuild with puppet and other CM systems.
(the other better alternative we will employ right now, is the local git repo of easyconfigs)

@hpcugentbot
Copy link

Automatic reply from Jenkins: Can I test this?

@boegel
Copy link
Member

boegel commented Nov 8, 2013

test this please

@boegel
Copy link
Member

boegel commented Nov 8, 2013

@fgeorgatos: I agree it would be very useful to have a good way to easily allow site customizations soon, but rushing things in like this is not the way.

Although what @wpoely86 proposes here is an initial step, supporting this differently and more consistently (across command line, environment variables and config file entries) will be a much better solution. Like @stdweird already mentioned, the new easyconfig format also plays an important role in this.

We're currently focusing on that (the new easyconfig format), and I feel it's pretty clear that supporting site customizations in a nice & clean way is going to be the next big thing we look into.

So, for now, this won't go in as is. I'll leave the PR open for reference, but I doubt it'll go in in this form. I'll discuss this with @stdweird in due time, and maybe we should briefly discuss this during an upcoming EB conf call (although the next one would probably be a bit soon).

If you want to help out, try clearly documenting the various options we discussed during the hackathon. We did so on the whiteboard, and you and me both have a picture of it, but I don't think there's much of this in the hackathon notes (yet). Documenting what we discussed there will definitely help in focusing the effort.

@fgeorgatos
Copy link
Collaborator

Hi,

just for the record, we have had use-cases for this PR on our end
(namely, allow for system-wide tunables so that when users rebuild openmpi etc they get an OAR-patched build);
so, if wpoely86 comes at the meeting today it would be good to refresh status of this PR, for either party...

@fgeorgatos
Copy link
Collaborator

@boegel : ping ;-)

@boegel
Copy link
Member

boegel commented Aug 14, 2015

@fgeorgatos: I have some concerns w.r.t. combo with --try, reproducibility of builds (stored easyconfig files don't include modifications), ability to only override via environment variable(s) (no cmdline or cfgfile support), etc.

We need a better solution here imho, probably via a configuration option like --site-customisations, which takes a file in .ini format that specifies site customisations?

@boegel boegel modified the milestone: v2.x Jan 23, 2016
@damianam
Copy link
Member

This has been inactive for 3 years. I guess there isn't much interest on it since the PR dates from 5 years ago. I'll close it up now guys in an effort to tidy up things, but if you think it is still relevant please open it again!

@damianam damianam closed this Oct 11, 2018
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