Conversation
|
|
Overall Grade |
Security Reliability Complexity Hygiene |
Code Review Summary
| Analyzer | Status | Updated (UTC) | Details |
|---|---|---|---|
| Python | Feb 25, 2026 2:23p.m. | Review ↗ | |
| Test coverage | Feb 25, 2026 2:23p.m. | Review ↗ |
Code Coverage Summary
| Language | Line Coverage (New Code) | Line Coverage (Overall) |
|---|---|---|
| Aggregate | 100% [✓ above threshold] |
100% |
| Python | 100% [✓ above threshold] |
100% |
➟ Additional coverage metrics may have been reported. See full coverage report ↗
There was a problem hiding this comment.
Pull request overview
Adds automatic detection of the active Conda environment when running plantcv.parallel.run_parallel, and injects activation commands into Dask job scripts when a prologue is not provided—targeting HPC/Jupyter setups where getenv is insufficient.
Changes:
- Add
_check_for_condahelper and call it fromrun_parallelto setcluster_config["job_script_prologue"]automatically. - Add a unit test for the Conda-detection helper using
monkeypatchonsys.executable. - Document the behavior in the parallel configuration docs.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
plantcv/parallel/run_parallel.py |
Adds Conda environment detection and config mutation to inject worker prologue activation. |
tests/parallel/test_run_parallel.py |
Introduces a unit test validating prologue generation from a mocked Conda-like sys.executable. |
docs/parallel_config.md |
Documents that PlantCV will attempt to auto-populate job_script_prologue when not provided. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Describe your changes
Not all parallel clusters have a simple option to fetch the conda environment that the original call to
plantcv-run-workflowhappened in. This is particularly a problem through jupyterconfig on the datascience jupyter server where there is no conda env active but it should also be relevant to PBS clusters, etc. This adds some logic inrun_parallelto find the conda env if thesys.executablepath includes a conda/miniforge directory and add activation commands to thejob_script_prologueif the prologue is empty.Type of update
This is a new feature.
Associated issues
Closes #1869
Additional context
This is probably difficult to test on the remote, I so far do not have any good ideas about rearranging the logic or modifying the tests to cover this.Monkeypatch works to mocksys.executableso splitting this into a helper function I can test the helper easily.For the reviewer
See this page for instructions on how to review the pull request.
plantcv/mkdocs.ymlupdating.md