-
Notifications
You must be signed in to change notification settings - Fork 8
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
Fixes, Improvements and CI #21
Conversation
LGTM |
4f9da26
to
d48c789
Compare
LGTM |
1 similar comment
LGTM |
0886e64
to
9efe486
Compare
LGTM |
9efe486
to
f6d496c
Compare
LGTM |
1 similar comment
LGTM |
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.
Leaving this as a comment since the PR is still labeled a WIP
.
variables: | ||
UPDATE_UBERENV: $CI_COMMIT_REF_NAME | ||
trigger: | ||
project: radiuss/conduit |
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.
@adrienbernede -- what is the relationship between conduit
and the uberenv
CI plan?
Is this the first of several triggers (e.g. for other radiuss
projects)?
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’m having a hard time validating Uberenv for every projects using it, and there are not so many.
This is both because there is no test in Uberenv per se, and because updating and testing it in other project is not automated. [EDIT: not blaming anyone]
What this does is to trigger conduit CI pipeline in Gitlab, asking for uberenv to be updated.
How it works:
In conduit, I added a script in (GitLab) CI that will be used only if UPDATE_UBERENV
is set. The value is supposed to be the branch name in Uberenv repo.
Now if I trigger Conduit pipeline with this variable, Conduit install will be tested with the specified version of uberenv. I intend to do the same for other projects using Uberenv, but the mechanism can be use to test newer version of spack, or cross-project integration in general.
Note: branch
will be set to master once feature/uberenv_ci will be merge in conduit. This PR is thus connected to LLNL/conduit#517
uberenv.py
Outdated
@@ -67,18 +67,30 @@ | |||
from os.path import join as pjoin | |||
|
|||
|
|||
def sexe(cmd,ret_output=False,echo = False): | |||
def sexe(cmd, ret_output=False, print_output=True, echo=False): |
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 function has grown to the extent that it needs better documentation on the different options and how they interact.
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.
Also, do we want print_output=True
by default? Especially since this changes the default behavior.
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 have maybe a hundred copies of this function :-)
for this use case:
if folks want to print the output, I would recommend using ret_output=True, and then printing the result outside of the this function.
Maybe I am just very superstitious, but not using res = p.communicate()[0]
has deadlocked for me in the distant past.
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.
OK, here is why I changed this function:
With the original implementation, the output of the function was either printed or returned. Making it almost* impossible to get both. This was a problem because I wanted to parse the output of spack install, but still show this output to the user.
"almost impossible" because one solution was to print the output after sexe
returned it. But I’m pretty sure no one wants to get the full spack install
output printed at once after the full install is complete... correct me if I’m wrong.
So with this implementation, I can both print the output in the terminal while it happens, and return it to parse for errors.
@kennyweiss by default, sexe used to print the output in terminal, and not return it, so I think we do want print_output=True
in order to match the original behavior.
@cyrush there are more advanced implementations for this, maybe more reliable? I chose to use something I understand well, at least as long as it works.
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.
@adrienbernede is it b/c you want to stream the output as well as parse it, as opposed to capture it all and print it?
I agree you will need to do that for such a long running command, however parsing the spack output of such a large operation might be brittle and a source of woes in the future.
Can you run a separate command to check if it is already installed before the install command? You might be able to get a more robust answer from a spack return code for a more specific command. If this is possible, then I don't think you need this change?
Overall your change to sexe looks ok - but I know that p.communicate()[0] is robust from years of use. I really don't want uberenv to deadlock on me :-)
Sorry for so much guidance on what seems like such a minor change, but I want to apply caution.
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.
@adrienbernede is it b/c you want to stream the output as well as parse it, as opposed to capture it all and print it?
Yes, that’s exactly what I meant.
Can you run a separate command to check if it is already installed before the install command? You might be able to get a more robust answer from a spack return code for a more specific command. If this is possible, then I don't think you need this change?
It’s in my plan to make Uberenv more robust using the hash of the desired spec to guide subsequent spack commands. I want Uberenv to ask spack to concretize the desired spec, and then use the generated spec to check for path/already installed etc.
(e.g. find_spack_pkg_path
isn’t robust as-is)
So once I have this improvement, I will be able to check in the spec is already installed, and won’t need this implementation of sexe()
anymore.
But first, I want a reliable way to check my changes. It’s so easy to leave a bug in this process.
Sorry for so much guidance on what seems like such a minor change, but I want to apply caution.
No worries, I’d rather have guidance now than later :)
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.
Reviewing myself...
uberenv.py
Outdated
@@ -67,18 +67,30 @@ | |||
from os.path import join as pjoin | |||
|
|||
|
|||
def sexe(cmd,ret_output=False,echo = False): | |||
def sexe(cmd, ret_output=False, print_output=True, echo=False): |
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.
OK, here is why I changed this function:
With the original implementation, the output of the function was either printed or returned. Making it almost* impossible to get both. This was a problem because I wanted to parse the output of spack install, but still show this output to the user.
"almost impossible" because one solution was to print the output after sexe
returned it. But I’m pretty sure no one wants to get the full spack install
output printed at once after the full install is complete... correct me if I’m wrong.
So with this implementation, I can both print the output in the terminal while it happens, and return it to parse for errors.
@kennyweiss by default, sexe used to print the output in terminal, and not return it, so I think we do want print_output=True
in order to match the original behavior.
@cyrush there are more advanced implementations for this, maybe more reliable? I chose to use something I understand well, at least as long as it works.
variables: | ||
UPDATE_UBERENV: $CI_COMMIT_REF_NAME | ||
trigger: | ||
project: radiuss/conduit |
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’m having a hard time validating Uberenv for every projects using it, and there are not so many.
This is both because there is no test in Uberenv per se, and because updating and testing it in other project is not automated. [EDIT: not blaming anyone]
What this does is to trigger conduit CI pipeline in Gitlab, asking for uberenv to be updated.
How it works:
In conduit, I added a script in (GitLab) CI that will be used only if UPDATE_UBERENV
is set. The value is supposed to be the branch name in Uberenv repo.
Now if I trigger Conduit pipeline with this variable, Conduit install will be tested with the specified version of uberenv. I intend to do the same for other projects using Uberenv, but the mechanism can be use to test newer version of spack, or cross-project integration in general.
Note: branch
will be set to master once feature/uberenv_ci will be merge in conduit. This PR is thus connected to LLNL/conduit#517
e6cebe3
to
6795633
Compare
6795633
to
eb01f2a
Compare
LGTM |
eb01f2a
to
35a4145
Compare
LGTM |
TODO: restriction not perfect for find_pkg, needs hash.
The goal is to trigger (dowstream) conduit pipeline with updated uberenv.
35a4145
to
5c6a915
Compare
@kennyweiss @cyrush |
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.
typo
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.
Looks good @adrienbernede
Please make sure to update the readthedocs documentation for the new capabilities / options.
res, out = sexe(spec_cmd, ret_output=True, echo=True) | ||
print(out) | ||
|
||
for line in out.split("\n"): |
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 add a comment above the for
line to say what this is doing ?
Looks like it is looking for duplicates?
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.
Done
uberenv.py
Outdated
|
||
if not "use_install" in self.opts: |
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.
Is the use_install
option documented?
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.
For some reason I don’t remember, I added this as an option but only used and assignable internally, so not really an option.
I’m making it a SpackEnv
field.
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.
Done
variables: | ||
UPDATE_UBERENV: $CI_COMMIT_REF_NAME | ||
trigger: | ||
project: radiuss/conduit |
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 I understand this correctly, these trigger gitlab CI builds for conduit.
Will there be any feedback for the uberenv PR about the success of the gitlab task? E.g. block the PR if it fails?
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.
Yes that’s what it is.
There is already a feedback, but since I used and abused of force push, it’s not obvious where to find it:
The last commit for which I added the "LGTM" sign-off has a testing status attached to it linking to the Gitlab corresponding CI pipeline.
35a4145
This feedback could be used on Github side to prevent from merging. Of course, updating Uberenv in Serac and Conduit may not be straightforward for known reasons and the test would then fail.
LGTM |
36419e0
to
300b721
Compare
LGTM |
@cyrush @kennyweiss @white238 May I merge the branch? I'm used to double review. :) |
overall looks good. I checked out the gitlab outputs, are there some hidden errors in there? Are things getting applied as we expect? |
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.
Looks good to me, but please look into the logged warnings that @cyrush noted.
300b721
to
df5fd04
Compare
LGTM |
This is a good catch leading to an interesting point: I keep force pushing micro changes to be able to trigger pipeline again. |
Fixes some undesired behavior introduced lately (see LLNL/conduit#502).
Also introduce some robustness improvements:
Add CI triggering Gitlab CI pipeline in Conduit and Serac.
Recent change: