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

Environment variables for installs/ include external dependencies #899

Closed
hamiltont opened this issue Jul 3, 2014 · 7 comments
Closed

Comments

@hamiltont
Copy link
Contributor

Currently we replace ~/.bash_profile, ~/.profile, and ~/.bashrc with our own version (from config/benchmark_config), so that the PATH is properly configured to include everything that has been installed into installs/.

This stinks, for a few reasons:

  • You can't just call --install-software and have the tests run properly after software is installed. You have to Ctrl-C, log out, and log back in, all to trigger bash to load up that new PATH variable
  • It only works for some shells. If the default shell is zsh, for example, it doesn't source any of these files on remote interactive login.
  • We are completely blowing away any prior files, and these are the kind of files you don't just erase without asking the user...many people customize them quite heavily

I think there's a pretty simple fix too::

  1. Update config/benchmark_config to print it's environment to stdout when finished
  2. Run config/benchmark_config and capture this environment
  3. Replace the running environment with the one that you got from (2)
  4. Now any subprocesses execute with a copy of our environment, which is super!

Step 3 might cause issues on some non-standard setups, so we could just swap out the environment bits we care about like PATH, LD_LIBRARY_PATH, etc. These are all non-destructive in config/benchmark_config.

I'll try to patch this up soon, just wanted to get the problem and fix out there for comment

@msmith-techempower
Copy link
Member

I agree that this method of setting the environment up in this was is... bad (for lack of a better word). It was done this way for historical purposes -- essentially, we had built the suite with the notion that it would only ever be set up on a 'clean' environment (such as a new EC2 instance, or a local VM). So, we compromised on how we handled the environment setup.

This causes a number of problems as the suite got larger, but the most annoying of which was having multiple versions of the same application in the environment and framework overwriting the previous with "their" required version (I'm looking pretty squarely at you, nginx).

For the long-term, we are going to try and make our suite more modular by design with regard to installed software. That is, if a given framework requires nginx and perl be installed, then it would specify the tarball to download (or w/e) from their setup.py before start is called. The suite would check that their required software exists in the installs directory (and downloads/extracts/configures/etc in the case where it is not), and then runs. The benefit to this is that there will be no environment setup that could overwrite a user's currently configured environment and each test will be in charge of their own installation and setup (rather than having a monolithic installer script, each test would -- when run -- bootstrap their requirements).

I do not mind you issuing a pull request to fix this environment-smashing for the short term, but I wanted you to be aware of our efforts to resolve this in the future.

@msmith-techempower
Copy link
Member

@hamiltont So, I'm going through my emails this morning, and I read this one and say to myself "man, this guy has put in a lot of effort to point out a problem that I have known about and just have not had the time to fix; I should respond and be really clear about where we want to go in the future."

So, I do. I write a big post about how we want to modularize all the installation software and make each framework describe their own software dependencies. I am content that I made my point that it's a "some day" task on our list, but I am little saddened that I (personally) simply do not have the time to work on it.

Then, I go back to reading my emails.

https://github.com/TechEmpower/FrameworkBenchmarks/pull/900/files

o.O

Okay... so, I'm going to kiss you. This is going to require a lot of testing on our end, but you seem to have done the lion's share of the work. Thank you!

@hamiltont
Copy link
Contributor Author

Ha ha - yay! You guys seem pretty on the ball for these type of big PRs, so I'll keep em coming :-)

@hamiltont
Copy link
Contributor Author

Ok, my strategy to fix this shall be called get your hands off my ~/.profile ;-)

See my branch for details. It's basically what I said above - I delete the current environment (except for some key values like HOME and PATH), source our own config/benchmark_config, and then replace our running environment with this new one that I just built.

The main benefit here is that any subprocess, or subprocess of a subprocess, or bash in python, etc, will have all of the proper environment variables, including a handy FWROOT variable (I am slowly removing hard-coded references to ~/FrameworkBenchmarks).

Note i'm leaving dependencies alone - this branch is all about ensuring the environment is consistent across different hosts and we are not interfering with users' private files.

The branch isn't done yet because a lot of the setup scripts (e.g. go/setup.py) manually set their environment variables, which is an unfortunate side effect of there not being a consistent environment when they were being added. So I'll have to dig through each one, remove any PATH/ENV/etc changes, and ensure they still work ok.

@msmith-techempower
Copy link
Member

I think that I would rather that each test set the environment variables upon which they rely manually, as go does. This keeps the user's environment clean and keeps problems (like go has) from occurring where one test of LanguageA requires a particular variable to be set, but another test on LanguageA requires it to be different.

hamiltont added a commit to hamiltont/FrameworkBenchmarks that referenced this issue Jul 6, 2014
This commit is my proof-of concept, only the 'go' test works right now.
You can look at go/ to see the changes required on a per-framework
basis - essentially I've modified go/setup.py to move the declaration
of the environment into go/bash_profile.sh

Each framework now gets a personal <framework>/installs directory, and
can declare any needed environment variables in
<framework>/bash_profile.sh, such as modifications to the PATH.

The FwBm code now provides an FWROOT environment variable to
*all* shell scripts (instead of ~/Frameworks being assumed).
Also, an IROOT environment variable is provided to any framework-specific
files (e.g. install.sh and bash_profile.sh) for the location of the install directory
for that framework. See go/bash_profile.sh to see me using both IROOT and
FWROOT.

By using IROOT, the strategy for installation is still controlled by python code and
the frameworks just reference IROOT and FWROOT in their scripts. These
variables are a nice step towards solving TechEmpower#448

The new function replace_environ in setup_util.py goes a long way towards
addressing TechEmpower#899 - as you can see I've removed all the changes to the ~/.bash_profile
from prerequisites.sh (and this commit serves as proof that everything still works) and
most of the changes from config/benchmark_profile
@hamiltont
Copy link
Contributor Author

@msmith-techempower the commit I just added is a proof-of-concept for what you're saying. It allows each framework to have it's own install directory and environment, all of which are isolated from the other frameworks. I've kept the installation directory strategy (unified or per-framework) inside of python, so if people don't feel like installing things separately for each test we can have a flag for choosing the current strategy of using one big unified directory

hamiltont added a commit to hamiltont/FrameworkBenchmarks that referenced this issue Jul 7, 2014
This commit is my proof-of concept, only the 'go' test works right now.
You can look at go/ to see the changes required on a per-framework
basis - essentially I've modified go/setup.py to move the declaration
of the environment into go/bash_profile.sh

Each framework now gets a personal <framework>/installs directory, and
can declare any needed environment variables in
<framework>/bash_profile.sh, such as modifications to the PATH.

The FwBm code now provides an FWROOT environment variable to
*all* shell scripts (instead of ~/Frameworks being assumed).
Also, an IROOT environment variable is provided to any framework-specific
files (e.g. install.sh and bash_profile.sh) for the location of the install directory
for that framework. See go/bash_profile.sh to see me using both IROOT and
FWROOT.

By using IROOT, the strategy for installation is still controlled by python code and
the frameworks just reference IROOT and FWROOT in their scripts. These
variables are a nice step towards solving TechEmpower#448

The new function replace_environ in setup_util.py goes a long way towards
addressing TechEmpower#899 - as you can see I've removed all the changes to the ~/.bash_profile
from prerequisites.sh (and this commit serves as proof that everything still works) and
most of the changes from config/benchmark_profile
hamiltont added a commit to hamiltont/FrameworkBenchmarks that referenced this issue Jul 7, 2014
This commit is my proof-of concept, only the 'go' test works right now.
You can look at go/ to see the changes required on a per-framework
basis - essentially I've modified go/setup.py to move the declaration
of the environment into go/bash_profile.sh

Each framework now gets a personal <framework>/installs directory, and
can declare any needed environment variables in
<framework>/bash_profile.sh, such as modifications to the PATH.

The FwBm code now provides an FWROOT environment variable to
*all* shell scripts (instead of ~/Frameworks being assumed).
Also, an IROOT environment variable is provided to any framework-specific
files (e.g. install.sh and bash_profile.sh) for the location of the install directory
for that framework. See go/bash_profile.sh to see me using both IROOT and
FWROOT.

By using IROOT, the strategy for installation is still controlled by python code and
the frameworks just reference IROOT and FWROOT in their scripts. These
variables are a nice step towards solving TechEmpower#448

The new function replace_environ in setup_util.py goes a long way towards
addressing TechEmpower#899 - as you can see I've removed all the changes to the ~/.bash_profile
from prerequisites.sh (and this commit serves as proof that everything still works) and
most of the changes from config/benchmark_profile
@hamiltont
Copy link
Contributor Author

Closing in favor of #915

hamiltont added a commit to hamiltont/FrameworkBenchmarks that referenced this issue Jul 8, 2014
This commit is my proof-of concept, only the 'go' test works right now.
You can look at go/ to see the changes required on a per-framework
basis - essentially I've modified go/setup.py to move the declaration
of the environment into go/bash_profile.sh

Each framework now gets a personal <framework>/installs directory, and
can declare any needed environment variables in
<framework>/bash_profile.sh, such as modifications to the PATH.

The FwBm code now provides an FWROOT environment variable to
*all* shell scripts (instead of ~/Frameworks being assumed).
Also, an IROOT environment variable is provided to any framework-specific
files (e.g. install.sh and bash_profile.sh) for the location of the install directory
for that framework. See go/bash_profile.sh to see me using both IROOT and
FWROOT.

By using IROOT, the strategy for installation is still controlled by python code and
the frameworks just reference IROOT and FWROOT in their scripts. These
variables are a nice step towards solving TechEmpower#448

The new function replace_environ in setup_util.py goes a long way towards
addressing TechEmpower#899 - as you can see I've removed all the changes to the ~/.bash_profile
from prerequisites.sh (and this commit serves as proof that everything still works) and
most of the changes from config/benchmark_profile
hamiltont added a commit to hamiltont/FrameworkBenchmarks that referenced this issue Jul 8, 2014
This commit is my proof-of concept, only the 'go' test works right now.
You can look at go/ to see the changes required on a per-framework
basis - essentially I've modified go/setup.py to move the declaration
of the environment into go/bash_profile.sh

Each framework now gets a personal <framework>/installs directory, and
can declare any needed environment variables in
<framework>/bash_profile.sh, such as modifications to the PATH.

The FwBm code now provides an FWROOT environment variable to
*all* shell scripts (instead of ~/Frameworks being assumed).
Also, an IROOT environment variable is provided to any framework-specific
files (e.g. install.sh and bash_profile.sh) for the location of the install directory
for that framework. See go/bash_profile.sh to see me using both IROOT and
FWROOT.

By using IROOT, the strategy for installation is still controlled by python code and
the frameworks just reference IROOT and FWROOT in their scripts. These
variables are a nice step towards solving TechEmpower#448

The new function replace_environ in setup_util.py goes a long way towards
addressing TechEmpower#899 - as you can see I've removed all the changes to the ~/.bash_profile
from prerequisites.sh (and this commit serves as proof that everything still works) and
most of the changes from config/benchmark_profile
hamiltont added a commit to hamiltont/FrameworkBenchmarks that referenced this issue Jul 8, 2014
This commit is my proof-of concept, only the 'go' test works right now.
You can look at go/ to see the changes required on a per-framework
basis - essentially I've modified go/setup.py to move the declaration
of the environment into go/bash_profile.sh

Each framework now gets a personal <framework>/installs directory, and
can declare any needed environment variables in
<framework>/bash_profile.sh, such as modifications to the PATH.

The FwBm code now provides an FWROOT environment variable to
*all* shell scripts (instead of ~/Frameworks being assumed).
Also, an IROOT environment variable is provided to any framework-specific
files (e.g. install.sh and bash_profile.sh) for the location of the install directory
for that framework. See go/bash_profile.sh to see me using both IROOT and
FWROOT.

By using IROOT, the strategy for installation is still controlled by python code and
the frameworks just reference IROOT and FWROOT in their scripts. These
variables are a nice step towards solving TechEmpower#448

The new function replace_environ in setup_util.py goes a long way towards
addressing TechEmpower#899 - as you can see I've removed all the changes to the ~/.bash_profile
from prerequisites.sh (and this commit serves as proof that everything still works) and
most of the changes from config/benchmark_profile
hamiltont added a commit to hamiltont/FrameworkBenchmarks that referenced this issue Jul 9, 2014
This commit is my proof-of concept, only the 'go' test works right now.
You can look at go/ to see the changes required on a per-framework
basis - essentially I've modified go/setup.py to move the declaration
of the environment into go/bash_profile.sh

Each framework now gets a personal <framework>/installs directory, and
can declare any needed environment variables in
<framework>/bash_profile.sh, such as modifications to the PATH.

The FwBm code now provides an FWROOT environment variable to
*all* shell scripts (instead of ~/Frameworks being assumed).
Also, an IROOT environment variable is provided to any framework-specific
files (e.g. install.sh and bash_profile.sh) for the location of the install directory
for that framework. See go/bash_profile.sh to see me using both IROOT and
FWROOT.

By using IROOT, the strategy for installation is still controlled by python code and
the frameworks just reference IROOT and FWROOT in their scripts. These
variables are a nice step towards solving TechEmpower#448

The new function replace_environ in setup_util.py goes a long way towards
addressing TechEmpower#899 - as you can see I've removed all the changes to the ~/.bash_profile
from prerequisites.sh (and this commit serves as proof that everything still works) and
most of the changes from config/benchmark_profile
hamiltont added a commit to hamiltont/FrameworkBenchmarks that referenced this issue Jul 9, 2014
This commit is my proof-of concept, only the 'go' test works right now.
You can look at go/ to see the changes required on a per-framework
basis - essentially I've modified go/setup.py to move the declaration
of the environment into go/bash_profile.sh

Each framework now gets a personal <framework>/installs directory, and
can declare any needed environment variables in
<framework>/bash_profile.sh, such as modifications to the PATH.

The FwBm code now provides an FWROOT environment variable to
*all* shell scripts (instead of ~/Frameworks being assumed).
Also, an IROOT environment variable is provided to any framework-specific
files (e.g. install.sh and bash_profile.sh) for the location of the install directory
for that framework. See go/bash_profile.sh to see me using both IROOT and
FWROOT.

By using IROOT, the strategy for installation is still controlled by python code and
the frameworks just reference IROOT and FWROOT in their scripts. These
variables are a nice step towards solving TechEmpower#448

The new function replace_environ in setup_util.py goes a long way towards
addressing TechEmpower#899 - as you can see I've removed all the changes to the ~/.bash_profile
from prerequisites.sh (and this commit serves as proof that everything still works) and
most of the changes from config/benchmark_profile
hamiltont added a commit to hamiltont/FrameworkBenchmarks that referenced this issue Jul 9, 2014
This commit is my proof-of concept, only the 'go' test works right now.
You can look at go/ to see the changes required on a per-framework
basis - essentially I've modified go/setup.py to move the declaration
of the environment into go/bash_profile.sh

Each framework now gets a personal <framework>/installs directory, and
can declare any needed environment variables in
<framework>/bash_profile.sh, such as modifications to the PATH.

The FwBm code now provides an FWROOT environment variable to
*all* shell scripts (instead of ~/Frameworks being assumed).
Also, an IROOT environment variable is provided to any framework-specific
files (e.g. install.sh and bash_profile.sh) for the location of the install directory
for that framework. See go/bash_profile.sh to see me using both IROOT and
FWROOT.

By using IROOT, the strategy for installation is still controlled by python code and
the frameworks just reference IROOT and FWROOT in their scripts. These
variables are a nice step towards solving TechEmpower#448

The new function replace_environ in setup_util.py goes a long way towards
addressing TechEmpower#899 - as you can see I've removed all the changes to the ~/.bash_profile
from prerequisites.sh (and this commit serves as proof that everything still works) and
most of the changes from config/benchmark_profile
hamiltont added a commit to hamiltont/FrameworkBenchmarks that referenced this issue Jul 11, 2014
This commit is my proof-of concept, only the 'go' test works right now.
You can look at go/ to see the changes required on a per-framework
basis - essentially I've modified go/setup.py to move the declaration
of the environment into go/bash_profile.sh

Each framework now gets a personal <framework>/installs directory, and
can declare any needed environment variables in
<framework>/bash_profile.sh, such as modifications to the PATH.

The FwBm code now provides an FWROOT environment variable to
*all* shell scripts (instead of ~/Frameworks being assumed).
Also, an IROOT environment variable is provided to any framework-specific
files (e.g. install.sh and bash_profile.sh) for the location of the install directory
for that framework. See go/bash_profile.sh to see me using both IROOT and
FWROOT.

By using IROOT, the strategy for installation is still controlled by python code and
the frameworks just reference IROOT and FWROOT in their scripts. These
variables are a nice step towards solving TechEmpower#448

The new function replace_environ in setup_util.py goes a long way towards
addressing TechEmpower#899 - as you can see I've removed all the changes to the ~/.bash_profile
from prerequisites.sh (and this commit serves as proof that everything still works) and
most of the changes from config/benchmark_profile
hamiltont added a commit to hamiltont/FrameworkBenchmarks that referenced this issue Jul 11, 2014
This commit is my proof-of concept, only the 'go' test works right now.
You can look at go/ to see the changes required on a per-framework
basis - essentially I've modified go/setup.py to move the declaration
of the environment into go/bash_profile.sh

Each framework now gets a personal <framework>/installs directory, and
can declare any needed environment variables in
<framework>/bash_profile.sh, such as modifications to the PATH.

The FwBm code now provides an FWROOT environment variable to
*all* shell scripts (instead of ~/Frameworks being assumed).
Also, an IROOT environment variable is provided to any framework-specific
files (e.g. install.sh and bash_profile.sh) for the location of the install directory
for that framework. See go/bash_profile.sh to see me using both IROOT and
FWROOT.

By using IROOT, the strategy for installation is still controlled by python code and
the frameworks just reference IROOT and FWROOT in their scripts. These
variables are a nice step towards solving TechEmpower#448

The new function replace_environ in setup_util.py goes a long way towards
addressing TechEmpower#899 - as you can see I've removed all the changes to the ~/.bash_profile
from prerequisites.sh (and this commit serves as proof that everything still works) and
most of the changes from config/benchmark_profile
hamiltont added a commit to hamiltont/FrameworkBenchmarks that referenced this issue Jul 16, 2014
This commit is my proof-of concept, only the 'go' test works right now.
You can look at go/ to see the changes required on a per-framework
basis - essentially I've modified go/setup.py to move the declaration
of the environment into go/bash_profile.sh

Each framework now gets a personal <framework>/installs directory, and
can declare any needed environment variables in
<framework>/bash_profile.sh, such as modifications to the PATH.

The FwBm code now provides an FWROOT environment variable to
*all* shell scripts (instead of ~/Frameworks being assumed).
Also, an IROOT environment variable is provided to any framework-specific
files (e.g. install.sh and bash_profile.sh) for the location of the install directory
for that framework. See go/bash_profile.sh to see me using both IROOT and
FWROOT.

By using IROOT, the strategy for installation is still controlled by python code and
the frameworks just reference IROOT and FWROOT in their scripts. These
variables are a nice step towards solving TechEmpower#448

The new function replace_environ in setup_util.py goes a long way towards
addressing TechEmpower#899 - as you can see I've removed all the changes to the ~/.bash_profile
from prerequisites.sh (and this commit serves as proof that everything still works) and
most of the changes from config/benchmark_profile
hamiltont added a commit to hamiltont/FrameworkBenchmarks that referenced this issue Jul 18, 2014
This commit is my proof-of concept, only the 'go' test works right now.
You can look at go/ to see the changes required on a per-framework
basis - essentially I've modified go/setup.py to move the declaration
of the environment into go/bash_profile.sh

Each framework now gets a personal <framework>/installs directory, and
can declare any needed environment variables in
<framework>/bash_profile.sh, such as modifications to the PATH.

The FwBm code now provides an FWROOT environment variable to
*all* shell scripts (instead of ~/Frameworks being assumed).
Also, an IROOT environment variable is provided to any framework-specific
files (e.g. install.sh and bash_profile.sh) for the location of the install directory
for that framework. See go/bash_profile.sh to see me using both IROOT and
FWROOT.

By using IROOT, the strategy for installation is still controlled by python code and
the frameworks just reference IROOT and FWROOT in their scripts. These
variables are a nice step towards solving TechEmpower#448

The new function replace_environ in setup_util.py goes a long way towards
addressing TechEmpower#899 - as you can see I've removed all the changes to the ~/.bash_profile
from prerequisites.sh (and this commit serves as proof that everything still works) and
most of the changes from config/benchmark_profile
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

No branches or pull requests

2 participants