Skip to content

Parallel get env#1874

Merged
nfahlgren merged 19 commits intov5.0from
parallel-get-env
Feb 25, 2026
Merged

Parallel get env#1874
nfahlgren merged 19 commits intov5.0from
parallel-get-env

Conversation

@joshqsumner
Copy link
Copy Markdown
Contributor

@joshqsumner joshqsumner commented Feb 4, 2026

Describe your changes
Not all parallel clusters have a simple option to fetch the conda environment that the original call to plantcv-run-workflow happened 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 in run_parallel to find the conda env if the sys.executable path includes a conda/miniforge directory and add activation commands to the job_script_prologue if 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 mock sys.executable so 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.

  • PR functionality reviewed in a Jupyter Notebook
  • All tests pass
  • Test coverage remains 100%
  • Documentation tested
  • New documentation pages added to plantcv/mkdocs.yml
  • Changes to function input/output signatures added to updating.md
  • Code reviewed
  • PR approved

@joshqsumner joshqsumner added help wanted Request help work in progress Mark work in progress merge in order Set of PRs that need to be merged sequentially labels Feb 4, 2026
@deepsource-io
Copy link
Copy Markdown

deepsource-io Bot commented Feb 4, 2026

DeepSource Code Review

We reviewed changes in dd09c4f...0ae03c2 on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

PR Report Card

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 ↗

@joshqsumner joshqsumner added enhancement Enhancements to existing features ready to review and removed help wanted Request help work in progress Mark work in progress labels Feb 4, 2026
@nfahlgren nfahlgren modified the milestone: PlantCV v5.0 Feb 23, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_conda helper and call it from run_parallel to set cluster_config["job_script_prologue"] automatically.
  • Add a unit test for the Conda-detection helper using monkeypatch on sys.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.

Comment thread plantcv/parallel/run_parallel.py Outdated
Comment thread plantcv/parallel/run_parallel.py Outdated
Comment thread docs/parallel_config.md Outdated
Comment thread tests/parallel/test_run_parallel.py Outdated
Comment thread plantcv/parallel/run_parallel.py Outdated
joshqsumner and others added 2 commits February 25, 2026 08:22
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@nfahlgren nfahlgren merged commit 4bce2f6 into v5.0 Feb 25, 2026
7 of 8 checks passed
@nfahlgren nfahlgren deleted the parallel-get-env branch February 25, 2026 17:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Enhancements to existing features merge in order Set of PRs that need to be merged sequentially ready to review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants