-
Notifications
You must be signed in to change notification settings - Fork 9
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
2021-01 cyrush workarounds and tweaks #46
Conversation
uberenv.py
Outdated
@@ -814,9 +842,15 @@ def install(self): | |||
print("[install complete!]") | |||
# otherwise we are in the "only dependencies" case and the host-config | |||
# file has to be copied from the do-be-deleted spack-build dir. | |||
# ------- | |||
# NOTE: USING DEV BUILD, there is no `spack-build` dir |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cyrush yes there is a spack-build
dir, it is created as the source top dir.
The role of dev-build
is to use the local version of the sources, that's why it is convenient: the host-config gets generated next to the local version of the source (in src/spack-build
).
Then, uberenv moves the host-config file from src/spack-build
to src
, and removes src/spack-build
.
If I understand correctly, that's where is becomes a problem for you: you may have several host-config files there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct. Overall, I want to avoid creating or deleting directories anywhere other than the prefix.
If things are limited to the prefix, I can avoid surprises.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I though I checked to see if the spack-build
was created for my case, and I didn't see evidence it happened (maybe b/c it was deleted before I could check) but I thought I put in echos to see if ubrerenv saw it. I can double check when I am back working on this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed this comment, not sure if its still an issue but it relates to a path I am not testing.
uberenv.py
Outdated
if not self.use_install: | ||
install_cmd = "spack/bin/spack " | ||
if self.opts["ignore_ssl_errors"]: | ||
install_cmd += "-k " | ||
if not self.opts["install"]: | ||
install_cmd += "dev-build --quiet -d {0} ".format(self.pkg_src_dir) | ||
if self.uberenv_package_name: | ||
# fake package path |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isnt always a fake package. This would also be helpful for installing an actual package that exists. Or am i missing something?
Like if i was in serac and wanted to build axom in their setup.
Though I'm not sure why this is toggling dev-build vs install.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if uberenv_package_name
exists, it doesn't use the dev build logic. that pretty much it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added self.use_dev_build
as a better way of identifying the logic
uberenv.py
Outdated
@@ -150,6 +150,11 @@ def parse_args(): | |||
dest="package_name", | |||
default=None, | |||
help="override the default package name") | |||
# overrides uberenv_package_name | |||
parser.add_option("--uberenv-package-name", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is this different from --package-name that already exists?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
its presence triggers non dev build for the "non install" case (like ancient ubrerenv)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--force-spack-install?
then you would end up with spack --package-name=fakepackage --force-spack-install
or just spack --force-spack-install
which would end up with default package for the project.
My concern is how is a user supposed to know the difference between:
spack --package-name=foo
spack --uberenv-package-name=foo
without digging into the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better names are certainly welcome.
I think this will be set only in the json file for the most part.
use case is to have uberenv work out of the box to build tpls when the --install
option is not passed.
Having the option only be in the json file might be another option?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Engage-Cyrus-Mode? =)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't fully understand the use case, but I agree with @white238 that this should either not be exposed to the command line or have a better name.
In either event, I think it needs to be better explained.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am fine with removing this as an option from the command line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cyrush -- I think I get the general idea, but I am not sure I understand what the exact problem is and how this solves it.
The logic here seems like it can get pretty hairy and difficult to maintain.
Is the problem that you want to control where the host-config gets generated?
If so, would it be simpler to have spack generate the host-config to its build/scratch directory
and allow uberenv to specify where we want to copy this file? (with a reasonable default)?
Or is there a different issue that I'm missing?
uberenv.py
Outdated
@@ -150,6 +150,11 @@ def parse_args(): | |||
dest="package_name", | |||
default=None, | |||
help="override the default package name") | |||
# overrides uberenv_package_name | |||
parser.add_option("--uberenv-package-name", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't fully understand the use case, but I agree with @white238 that this should either not be exposed to the command line or have a better name.
In either event, I think it needs to be better explained.
@@ -170,6 +175,12 @@ def parse_args(): | |||
default=pjoin(uberenv_script_dir(),"project.json"), | |||
help="uberenv project settings json file") | |||
|
|||
# option to explicitly set the number of build jobs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
uberenv.py
Outdated
try: | ||
setting_value = self.project_opts[setting] | ||
except (KeyError): | ||
print("ERROR: '{0}' must at least be defined in project.json".format(setting)) | ||
raise | ||
if optional: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Am I reading this right?
It tries to get the setting from project_opts
(which is read in from project.json
), and if it is not there (KeyError
)
then it throws an error when the setting is optional but returns None
when it it not optional?
Should it instead be:
if optional: | |
if not optional: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this behavior is a bit complex, can you please add a docstring to explain what this is supposed to do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe the issue is about what optional
is modifying.
Is it saying that:
- having it in
self.project_opts
is optional - having it in
self.opts
is optional - having it in both of these is optional
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my logic was wrong. (note this is still WIP)
I was surprised that many things are required in the json file, even though they may not be applicable. Like:
pacakge_final_phase
We have a check in the logic that applies it:
if self.pkg_final_phase:
install_cmd += "-u {0} ".format(self.pkg_final_phase)
But you can't actually run uberenv unless it is there is a json file entry.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @cyrush -- I agree that we should have sensible defaults, when applicable, to reduce the necessary entries in the project.json
file
uberenv.py
Outdated
if self.pkg_final_phase: | ||
install_cmd += "-u {0} ".format(self.pkg_final_phase) | ||
else: | ||
install_cmd += "install " | ||
if self.opts["build_jobs"]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a bit hard to see how this all lines up w/in github, but it seems that these two lines appear in both branches:
if self.opts["build_jobs"]:
install_cmd += "-j {0}".format(self.opts["build_jobs"])
It so, and if the order of command line args don't matter, they should be pulled out one level
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch, i'll refactor
For context: I took several passes are using the dev build, including trying to inject fine grained control of the generated host config location, but I was not able to get parity with the original "uberenv fake" package approach. The goal for the fake package is support is to retain the workflow driving the setup of all the TPLs required for development when uberenv is invoked with no args (relying on the project json file) and to also support deployment with install.
The "uberenv fake" package helps in the following ways:
Draw backs of the fake package approach:
Since I have used the fake package approach for many years, the downsides are a known quantity. As I upgrade I am interested in vcpkg support and future spack env support, but dev build doesn't help me keep my current workflow. I am not against folks using the dev build approach if that works for their dev workflow, but I would like to be to restore the fake package workflow, given it has been successful since the beginning of uberenv. |
also resolves: |
@kennyweiss @white238 |
Is there something else |
it specifies overridden package name |
refactored input options to provide a These options allow us to hand a specific build mode string down to the ubrerenv instances. refactored spack instance logic to route this into Supported for spack are, |
uberenv.py
Outdated
dest="build_mode", | ||
default=None, | ||
help="set mode used to build third party dependencies " | ||
"(spack options: 'dev-build' 'uberenv-pkg')") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cyrush -- a comment that you posted indicates that install
is also an option. Should it be added to this help line as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like a much cleaner way to expose this functionality!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking through the code, it appears that install
will be used if one does not set --build-mode
,
so, perhaps the help
should indicate that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's actually more complex than that :-(
The default build_mode
should effectively be dev-build
The reason why it's complex has to do with the logic for command line args vs json overrides.
There is no one place for defaults, if you add a default in the command line arg def -- it will always override the json key (which isn't what we want).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @cyrush -- this is a lot cleaner than the previous version.
I think the logic for setting up the type of build is getting too complex and hard to follow, so we should consider if we can refactor that in the future.
It will be really helpful to have some automated CI tests on the uberenv user codes to support that refactor (as @adrienbernede is planning)
uberenv.py
Outdated
dest="build_mode", | ||
default=None, | ||
help="set mode used to build third party dependencies " | ||
"(spack options: 'dev-build' 'uberenv-pkg')") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking through the code, it appears that install
will be used if one does not set --build-mode
,
so, perhaps the help
should indicate that?
uberenv.py
Outdated
raise | ||
if not optional: | ||
print("ERROR: '{0}' must at least be defined in project.json".format(setting)) | ||
raise | ||
else: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think this else needs to go
There is a CI setup for Uberenv. It triggers a pipeline in both Serac and Conduit to check compatibility with the new Uberenv script. Watch me... |
LGTM |
And it will fail miserably for various reasons :( |
@adrienbernede is there any good info to pull from the gitlab tests? |
The problem in Serac is that I just don't have access to their bank. Although I think they were OK with granting me access. |
I'll see if I can get this to work. |
I can confirm that this does not break Serac CI. |
thanks @adrienbernede ! |
uberenv.py
Outdated
@@ -151,6 +151,14 @@ def parse_args(): | |||
default=None, | |||
help="override the default package name") | |||
|
|||
# uberenv tpl build mode | |||
parser.add_option("--build-mode", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
spack-build-mode?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i made this change
spack_dir = self.dest_spack | ||
cmd = pjoin(spack_dir,"bin","spack") | ||
cmd += " python " | ||
cmd += '-c "import sys; print(sys.executable);"' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
This branch includes:
-j
option to control build jobs (override what is presented in configs for more control)WIP.
I don't expect us to merge as is. Need a better solution for #44, we should discuss.
Note: I am using this branch to allow me to move forward with updating uberenv for conduit.