Conversation
…G to manage manually; update install/add commands with --setup option
|
@scheibelp OK I've done an initial once-over pass merging from #7846. Now time to try it out, test it, and work out the kinks. I don't think this will be so bad... most of the code from #7846 is now-obsolete Alpha test Environments stuff. The code relevant to implementing Spack Setup (as opposed to the UI) was pretty self-contained. |
|
@scheibelp Spack Setup looks like this works now, can you take a look at it? I've tried stuff like: The tricky logic just carried over from the previous (well-tested) PR, so I have relatively high confidence in it. This PR is now ready for:
Backing up, recent conversations with @tgamblin suggest a possible future in which Spack is a LOT better at defining and using environments. Advantages would be:
Wary of making the perfect the enemy of the good, I think we should merge what we have now (that's been waiting for a long time and that people want); and then go on to something better. |
lib/spack/spack/package.py
Outdated
| if not self.unit_test_check(): | ||
| return | ||
|
|
||
| try: |
There was a problem hiding this comment.
@citibeth This needs to be merged with the logic in the next try block; I plan on doing that myself, but I want to know what issue you are trying to avoid with this.
There was a problem hiding this comment.
Yes I agree they need to be merged; looks like a few lines of code got duplicated somehow.
The issue here is one a of a number of subtle, small but annoying things that crop up with Spack Install. Remember how spack setup is usually used:
spack install --setup mypackage mypackage
cd mypackage
mkdir build
../../mypackage-setup.py ..
make install
At this point, the make install command installs into the install directory created in line 1577 in the piece of code we're looking at. Now suppose the user decides that mypackage needs another dependency. So she edits mypackage/package.py, then does:
spack install --setup mypackage mypackage
cd mypackage/build
../../mypackage-setup.py ..
make install
This is a natural part of the iterative process. But it will cause an annoying error if you don't have the check for is_setup in line 1582. You shouldn't have to delete / uninstall your setup package just because you re-ran Spack. (Or put another way: Spack was making the assumption that spack install writes into an install directory. That assumption is no longer valid with spack setup, and management of the install directory is punted to the developer, i.e. the user of Spack).
Does this help?
…eption handling for the case that the install directory already exists
…v); in this case write_spconfig doesnt have to invoke setup_package
|
I have updated the prefix checking logic to respect #10403 (comment) I also updated A couple questions:
|
I gave it a go with The configuration via (in this case) I would say even a very minimalistic doc (i.e. an extension of The only thing from my perspective is the following: If a provided Thank you very much for pushing this feature @citibeth @scheibelp 👍 |
@scheibelp Can you explain more what you mean by this? Not sure what "current environment" refers to. Does this change remove the feature that writes the |
By "current environment" I mean the shell where the user is running Spack: if you execute Is that clearer? |
Removed line that copies over the user's environment unconditionally. This should only happen in "dirty" mode. This line was probably put in at some point trying to debug. I'm not sure what the effects might be of removing it. It may turn out that `--dirty` is required for most/all cases (for example, anything using a sysadmin-installed compiler where you need env vars set to have it work). If this turns out to be the case, we should consider a way for users to set the `--dirty` flag by default for an environment.
Generally Spack claims control over all Spack prefixes. Part of its logic automatically deletes the install prefix if it exists but the package isn't registered in the DB. The
Writing the file did not change the environment, but executing |
|
On Wed, Jan 30, 2019 at 9:36 PM Peter Scheibel ***@***.***> wrote:
Does 0ebabc1
<0ebabc1>
mean that now, it is no longer an error for Spack to try to create an
install directory that already exists? Why the change?
Generally Spack claims control over all Spack prefixes. Part of its logic
automatically deletes the install prefix if it exists but the package isn't
registered in the DB. The AlreadyExists exception was vestigial. This PR
adds one case where that shouldn't occur, but that is handled by the
conditional execution of check_for_unfinished_installation.
OK... the bottom line is, if you're doing `--setup` on a package, then
Spack should not delete the install directory. Spack Setup cedes control
of the install directory to the user. Is that the case in the current
incarnation?
I don't understand the rationale for 65c008e
<65c008e>.
Writing the xxx-setup.py ("spconfig") file doesn't change any environments.
It just writes a text file.
Writing the file did not change the environment, but executing
setup_package did.
def write_spconfig(self, spack_env, spconfig_fname, dirty):
# Execute all environment setup routines.
spack.build_environment.setup_package(self, dirty) <------ potentially problematic line that was removed by 65c008e
Wow, good eye! I'm glad this PR is getting a thorough review.
|
That is the intent, and I think this iteration handles it. It should be tested (along with any other "really important" property). |
In my use of Spack Setup so far, I've observed an (unwritten) rule that if X->Y and Y is setup, then so is X. That has worked for me so far because the packages I'm developing are at the top of the DAG. That's probably the most common case. Currently, there is no check for this property. Adding a check (and error message) at the point of concretization would be a positive addition to this PR, and not very hard. One could imagine situations that don't follow this property. For example, you're trying to debug a basic library (say, NetCDF) deep in the DAG, and so you do setup on that library; but everything else you want to do regular To support this kind of use case, Spack would need a "phased install" approach. You would run This feels like doing a I believe we should seriously consider this kind of feature, but not in this PR. For this PR, a simple check that "A->B and (B is setup) implies A is setup" would be sufficient. |
…x handling since the first setup iteration, they are no longer necessary
f4d7b54 to
36f3d65
Compare
scheibelp
left a comment
There was a problem hiding this comment.
@citibeth I have a couple additional questions
Would it be helpful, either now or in a future PR, to associate each setup package with its location? For now, I'm not sure how setup dependents find setup dependencies (since they aren't built in the Spack prefix).
| return fname | ||
|
|
||
| def _write_spconfig(self, fout, dirty): | ||
| """Writes the spconfig.py file to a stream.""" |
There was a problem hiding this comment.
I don't necessarily want to hold up this PR on this point, but I think the following is worth discussing at least briefly:
There are two contexts for dirty, and the value of this variable will affect both of them:
- Whether
setup_packageusesos.environfrom the user's shell when they executedspack install --setup... - Whether the full environment as modified by Spack (including definition of variables like
CC,SPACK_DEPENDENCIES, etc.) are available in the environment
Currently specifying --dirty will do both. I imagine users may desire to do just the latter. For one, all the Spack compiler wrappers (with their RPATHing and -L insertion) should be functional (because all the env vars they need are defined). This also means that sp-config.py will set the environment in the same way that running spack build-env does.
It also occurs to me that if you want --dirty in the sense that you pull all of the shell environment, spconfig itself could support an argument like that: if you invoke it with --dirty then it could update os.environment rather than overwrite it.
There was a problem hiding this comment.
There are two contexts for
dirty, and the value of this variable will affect both of them:
I was not aware of the second meaning of --dirty. Historically, Spack Setup has not enabled the use of the Spack wrappers (which didn't historically work outside of Spack). In spite of this flaw, the feature was quite useful anyway. But I agree, setting things up exactly the same as spack build-env would be better (and could also reduce duplicated functionality within Spack.)
It also occurs to me that if you want
--dirtyin the sense that you pull all of the shell environment,spconfigitself could support an argument like that: if you invoke it with--dirtythen it could updateos.environmentrather than overwrite it.
I think the right place for the dirty flag is in the env.yaml file. My general logic behind this conclusion is: the reason people use --dirty is because, for whatever reason, a package doesn't build in a clean environment. That's a property of the package and system Spack is running on. If a package on a particular system requires --dirty once, then it will require it every time things are built / configured. Users shouldn't have to remember that "package A requires dirty but package B does not." Hence, it should be placed in env.yaml when needed.
I don't necessarily want to hold up this PR on this point, but I think the following is worth discussing at least briefly:
I recommend we just merge as-is; and then follow on with another PR that unifies spack build-env and spack setup. I think it will take some thought and experimentation. (Meaning: I put the dirty stuff in there because I needed it. Trying to build my stuff will be a good test of any alternative we come up with.)
Not sure what you mean by the "location" of a setup package? Do you mean the install location or the location of the source? I don't think Spack needs to keep track of the location of the source; after all, for non-setup packages, it deletes the source code! |
You have NO IDEA what a headache that issue has been. If you don't create the directory, various things don't work. No, I don't remember. If someone wants to address the issue, they can start by removing the directory creation, then see what happens. |
|
@scheibelp @tgamblin |
|
It's great that #11372 got merged. Can we get this one merged too? Its kind of gumming up a lot of things. |
|
What can I do to get this merged? It has, yet again, fallen out of sync with Can we get this merged? How can I help? |
|
@citibeth: sorry, it’s been busy with releases and such. One issue with this PR is that is has no tests. The patch coverage is 50%. If you can get it to 90+%, so that |
|
Problem is I don't know how to make tests and I need help figuring out what
such test might do and then test for.
…On Sat, Dec 14, 2019 at 4:47 PM Todd Gamblin ***@***.***> wrote:
@citibeth <https://github.com/citibeth>: sorry, it’s been busy with
releases and such. One issue with this PR is that is has no tests. The
patch coverage is 50%. If you can get it to 90+%, so that spack setup
will be in our regression tests, we’ll get it merged for 0.14. Sound good?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#10403?email_source=notifications&email_token=AAOVY5ZSWLWYQ3PAQVBJKMTQYVH53A5CNFSM4GROCB42YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEG4MBSA#issuecomment-565756104>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAOVY56QZBPCJ6BJXY2QR3DQYVH53ANCNFSM4GROCB4Q>
.
|
|
I took a look at lending a hand on this, but it doesn't rebase cleaning onto the current develop. Looks like some of the yaml config bits have changed (perhaps including ideas/flags from the PR?) and I don't have the context to figure out how it's all intended to fit together. @citibeth -- if you can get it rebased onto develop, I can find the TUIT's to either set up some tests or at least frame them out so that you can fill in the thought-requiring bits. I'm going to be out of pocket between now and Christmas, but should have time after. |
|
Big thanks that is a really nice offer and motivates me to rebase
…On Wed, Dec 18, 2019 at 13:08 George Hartzell ***@***.***> wrote:
I took a look at lending a hand on this, but it doesn't rebase cleaning
onto the current develop. Looks like some of the yaml config bits have
changed (perhaps including ideas/flags from the PR?) and I don't have the
context to figure out how it's all intended to fit together.
@citibeth <https://github.com/citibeth> -- if you can get it rebased onto
develop, I can find the TUIT's to either set up some tests or at least
frame them out so that you can fill in the thought-requiring bits. I'm
going to be out of pocket between now and Christmas, but should have time
after.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#10403?email_source=notifications&email_token=AAOVY5YB5LUFB2E4D6L4OI3QZJRIVA5CNFSM4GROCB42YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEHG7N2Q#issuecomment-567146218>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAOVY52DSEUHHNXRXEORF4TQZJRIVANCNFSM4GROCB4Q>
.
|
This is a follow-on to #10394. In order to foster collaboration, the GitHub branch has been moved to the main Spack repo, allowing easy write access by @citibeth and @scheibelp.