-
Notifications
You must be signed in to change notification settings - Fork 467
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
Add exception for missing system requirements #281
Add exception for missing system requirements #281
Conversation
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.
Overall, the code changes look good to me. I’m away from my machine so I can’t verify functionality right now. I added a small change request in the comments regarding the error message.
Thanks a lot for your contribution Kamalesh
result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True, shell=True) | ||
if result.returncode!=0: | ||
raise DoesNotExistException( | ||
f"Unable to find linux/unix installation of {req}" |
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.
In my opinion this message should be os - agnostic. Maybe also add a sentence on what the user should do to fix this. Maybe a second sentence like: “Please install the package and retry.”
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, even I was thinking about this. I will try to use platform to print a more OS-specific message. The only issue is platform.system() prints 'Darwin' for macOS and that might confuse the user at times.
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.
Alternativly, you could also just not mention the platform at all. The user already knows his platform and can find the appropriate way to install the package.
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.
Yup, I will do that.
I like the implementation using the additional dict of system requirements! We might consider using |
Thank you for the suggestion, I will change the subprocess to shutil.which . |
Makes sense that we have failing tests now, as they also have a dependency on check_installation. For the scope of this bugfix it might make sense to hard code the installation of graphviz on the level of our github actions. In the long run we could then maybe have a feature ticket to implement this in a more generic way for all possible future “System requirements” as well. Do you need any additional guidance regarding our github actions? |
So the idea is to now ensure that graphviz is installed on the system that the github actions is testing? Please do correct me if I am wrong. |
I have modified the error message, subprocess library and the github actions as well in the new commit. |
Thanks Kamalesh. I don’t see any changes on the github actions within your commit. I think you may have forgotten to commit or push your changes within the .github folder? |
f5ef0a2
to
e20cdba
Compare
Yup sorry I forgot to push them. I have modified the commit and pushed it again. |
.github/workflows/pull_request.yml
Outdated
@@ -24,6 +24,14 @@ jobs: | |||
with: | |||
python-version: ${{ matrix.python-version }} | |||
|
|||
- name: Install System Dependencies |
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 believe the correct syntax here would be to name each condition separately:
- name: condition no 1
if: condition_1=true
run: script for condition 1
- name: condition 2
if: condition_2=true
run: script for condition 2
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.
Okay, that makes sense. I have pushed the changes, sorry for the inconvenience.
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.
The test failed since I used double quotes instead of using single quotes for specifying the system.
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 for all your efforts. Looks good to me so far 😊
Are you able to see the logs of the Github actions? There seem to be some linting issues. If you have no access I can paste the logs here
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.
Yup I have modified my code according to the error. :)
918d50a
to
899ca2c
Compare
@kamalesh0406 In order to fix these linting issues, we have a script in the
or simply:
You can also run linting as follows:
And tests as follows:
I'll add this to the CONTRIBUTING.md for future reference |
@kamalesh0406 Sorry for pushing directly onto your repo, I must have pressed the wrong button, was just gonna add it as a suggestion. I think now there's just a newline missing at the end of the file before we can merge |
Okay I will check it and push the changes. |
I am not able to recreate the linting issue on my local, can you specify the exact issue? The github actions output is not very clear as well. |
Locally within your repo you should be able to just run And yeah, I agree the logs in the Github actions could be a bit more specific. In this case the file src/zenml/integrations/integration.py is missing a newline at the end. |
@kamalesh0406 Looks great, thanks for your contribution 🙏 |
Pre-requisites
Please ensure you have done the following:
Types of changes
Describe changes
Briefly describe the changes you have introduced.
I have modified the check_installation function and the Integration class to look for missing system requirements particularly pertaining to the graphviz integration. The new code raises an Exception during zenml init were it mentions the library whose package is missing from the system. I tried to make it raise the error during zenml example run but for that to be done the changes should be done in example cli and it was mentioned in the following issue #266 that an override for check_installation is preferable.