Replace shell commands with subprocess.run#941
Merged
balvisio merged 1 commit intoJun 25, 2025
Conversation
2b90947 to
5622869
Compare
Collaborator
Author
|
/ok to test 5622869 |
5919932 to
d106dca
Compare
d106dca to
f099aec
Compare
Collaborator
Author
|
/ok to test f099aec |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #941 +/- ##
==========================================
+ Coverage 84.18% 84.19% +0.01%
==========================================
Files 144 144
Lines 9227 9227
==========================================
+ Hits 7768 7769 +1
+ Misses 1459 1458 -1 🚀 New features to boost your workflow:
|
dorotat-nv
approved these changes
Jun 24, 2025
Collaborator
|
/ok to test f099aec |
pstjohn
reviewed
Jun 24, 2025
pstjohn
reviewed
Jun 24, 2025
pstjohn
approved these changes
Jun 24, 2025
f099aec to
4321f12
Compare
Collaborator
Author
|
/ok to test 4321f12 |
Collaborator
Author
|
/ok to test e4e11f5 |
db8a3aa to
5401a5e
Compare
jstjohn
reviewed
Jun 24, 2025
jstjohn
reviewed
Jun 24, 2025
jstjohn
approved these changes
Jun 24, 2025
Collaborator
jstjohn
left a comment
There was a problem hiding this comment.
Added a suggestion about using something in the middle, shlex.split() on the string so it's copy/pastable to make the string command usable by subprocess.run, rather than specifying the command as a list of strings to subprocess.run, which is harder to copy/paste into the CLI.
Collaborator
|
It should handle all of the multi-new-line stuff that comes from making escaped strings (which are nice to copy/paste). For example: In [4]: import shlex
In [5]: test_cmd = """
...: echo \
...: "hi"
...: """
In [6]: test_cmd
Out[6]: '\necho "hi"\n'
In [7]: shlex.split(test_cmd)
Out[7]: ['echo', 'hi'] |
4324f93 to
d2d2f2c
Compare
Signed-off-by: Bruno Alvisio <balvisio@nvidia.com>
d2d2f2c to
9a4c548
Compare
Collaborator
Author
|
/ok to test 9a4c548 |
camirr-nv
pushed a commit
that referenced
this pull request
Jun 26, 2025
### Description <!-- Provide a detailed description of the changes in this PR --> Instead of using shell commands in Jupyter Notebooks we replace them with calls to `subprocess.run` so that in case of failure we have better logging of the error. ### Type of changes <!-- Mark the relevant option with an [x] --> - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Refactor - [ ] Documentation update - [x] Other (please describe): Improvement to logging ### CI Pipeline Configuration Configure CI behavior by applying the relevant labels: - [SKIP_CI](https://github.com/NVIDIA/bionemo-framework/blob/main/docs/docs/user-guide/contributing/contributing.md#skip_ci) - Skip all continuous integration tests - [INCLUDE_NOTEBOOKS_TESTS](https://github.com/NVIDIA/bionemo-framework/blob/main/docs/docs/user-guide/contributing/contributing.md#include_notebooks_tests) - Execute notebook validation tests in pytest - [INCLUDE_SLOW_TESTS](https://github.com/NVIDIA/bionemo-framework/blob/main/docs/docs/user-guide/contributing/contributing.md#include_slow_tests) - Execute tests labelled as slow in pytest for extensive testing > [!NOTE] > By default, the notebooks validation tests are skipped unless explicitly enabled. #### Authorizing CI Runs We use [copy-pr-bot](https://docs.gha-runners.nvidia.com/apps/copy-pr-bot/#automation) to manage authorization of CI runs on NVIDIA's compute resources. * If a pull request is opened by a trusted user and contains only trusted changes, the pull request's code will automatically be copied to a pull-request/ prefixed branch in the source repository (e.g. pull-request/123) * If a pull request is opened by an untrusted user or contains untrusted changes, an NVIDIA org member must leave an `/ok to test` comment on the pull request to trigger CI. This will need to be done for each new commit. ### Usage <!--- How does a user interact with the changed code --> ```python TODO: Add code snippet ``` ### Pre-submit Checklist <!--- Ensure all items are completed before submitting --> - [x] I have tested these changes locally - [x] I have updated the documentation accordingly - [x] I have added/updated tests as needed - [x] All existing tests pass successfully Signed-off-by: Bruno Alvisio <balvisio@nvidia.com> Signed-off-by: Ubuntu <camirr@nvidia.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Instead of using shell commands in Jupyter Notebooks we replace them with calls to
subprocess.runso that in case of failure we have better logging of the error.Type of changes
CI Pipeline Configuration
Configure CI behavior by applying the relevant labels:
Note
By default, the notebooks validation tests are skipped unless explicitly enabled.
Authorizing CI Runs
We use copy-pr-bot to manage authorization of CI
runs on NVIDIA's compute resources.
automatically be copied to a pull-request/ prefixed branch in the source repository (e.g. pull-request/123)
/ok to testcomment on the pull request to trigger CI. This will need to be done for each new commit.Usage
Pre-submit Checklist