Skip to content

Add wet run testing to github#43

Merged
Dhananjhay merged 51 commits intomainfrom
mackenzie/add-wetrun-testing
May 2, 2025
Merged

Add wet run testing to github#43
Dhananjhay merged 51 commits intomainfrom
mackenzie/add-wetrun-testing

Conversation

@mackenziesnyder
Copy link
Copy Markdown
Contributor

@mackenziesnyder mackenziesnyder commented Mar 31, 2025

MSE results:

  • run 1: 1.0965
  • run 2: 1.0965

To do:

  • decide on acceptable MSE, right now I've set it to 1.2mm (all 32 afids, x, y, z included).

Note:

  • wet runs take around 20 minutes to run due to model downloads
  • just for python3.10

for issue: #41

@Dhananjhay
Copy link
Copy Markdown
Contributor

Superb job @mackenziesnyder! I was wondering if it's possible to cache the CNN models so that we don't have to download them everytime a wet-run test is executed?

@Dhananjhay
Copy link
Copy Markdown
Contributor

We can reproduce the MSE to the exact decimal, i.e., 1.0965 on every run, so I was wondering if we need a threshold to begin with. What do you guys think? @mackenziesnyder @ataha24. Wet-run testing is basically to run the pipeline and make sure the rules are running properly and we can get a .fscv file out in the end.

@mackenziesnyder
Copy link
Copy Markdown
Contributor Author

Superb job @mackenziesnyder! I was wondering if it's possible to cache the CNN models so that we don't have to download them everytime a wet-run test is executed?

i will look into this! that would make the run a lot faster

@mackenziesnyder
Copy link
Copy Markdown
Contributor Author

We can reproduce the MSE to the exact decimal, i.e., 1.0965 on every run, so I was wondering if we need a threshold to begin with. What do you guys think? @mackenziesnyder @ataha24. Wet-run testing is basically to run the pipeline and make sure the rules are running properly and we can get a .fscv file out in the end.

I can set it to this exact value!

@ataha24
Copy link
Copy Markdown
Member

ataha24 commented Apr 4, 2025

Sounds good to me!

@mackenziesnyder
Copy link
Copy Markdown
Contributor Author

@Dhananjhay @ataha24 I've made the wet runs to be triggered on pull request, added --fidqc and --stereotaxy STN to the wet run, and removed the code that had attempted to cache the model dir. This one should be good to go!

@Dhananjhay
Copy link
Copy Markdown
Contributor

This looks awesome, @mackenziesnyder! One small thing - I just merged PR #46 where I removed the logic of running dry run tests using poethepoet and I was wondering if we could achieve the same here. You can refer to the main branch for guidance. Thanks again for the amazing work!

@mackenziesnyder
Copy link
Copy Markdown
Contributor Author

This looks awesome, @mackenziesnyder! One small thing - I just merged PR #46 where I removed the logic of running dry run tests using poethepoet and I was wondering if we could achieve the same here. You can refer to the main branch for guidance. Thanks again for the amazing work!

Will do!! I will refactor it to match !

@mackenziesnyder
Copy link
Copy Markdown
Contributor Author

@Dhananjhay I have tested this out and it ran successfully, I had to add an additional flag --conda-frontend conda because of a mamba dependency with conda. I think this is specific to the fact we do the dry and wet runs with poetry

@Dhananjhay
Copy link
Copy Markdown
Contributor

Amazing work @mackenziesnyder! I'll review this PR later today and merge it in, thank you!

@mackenziesnyder
Copy link
Copy Markdown
Contributor Author

Amazing work @mackenziesnyder! I'll review this PR later today and merge it in, thank you!

thanks!

@Dhananjhay
Copy link
Copy Markdown
Contributor

  • Replaced the Poetry-based environment with a Conda-based environment (run the pipeline by calling the run.py executable).
  • Implemented caching for Conda environments to reduce setup time.
  • Cached CNN models to avoid repeated downloads.
  • Resulted in optimizing the wet run testing timeline by ~ 58%.
  • Fixed some dry run tests by defining number of cores, i.e., c1 flag.

@Dhananjhay
Copy link
Copy Markdown
Contributor

I think this is good to merge. Let me know once you've reviewed the changes @mackenziesnyder!

run: |
conda activate snakebids-env
./autoafids/run.py test_data/bids_wetrun_testing test_out participant \
--cores all --force-output --stereotaxy STN --fidqc --use-conda --conda-frontend mamba | tee autoafids_output.log
Copy link
Copy Markdown
Contributor Author

@mackenziesnyder mackenziesnyder May 2, 2025

Choose a reason for hiding this comment

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

do we still need the --conda-frontend mamba here? I added this because it was needed when originally using poetry but when I activated a conda env and ran autoafids during a test on cbs I no longer needed this flag @Dhananjhay

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yeah, it's a little tricky to run with poetry but mainly we use it here to speed up the pipeline. When using conda, Snakemake by default injects --conda-frontend conda to resolve the dependencies; we instead use --conda-frontend mamba which is much faster at that!

Copy link
Copy Markdown
Contributor Author

@mackenziesnyder mackenziesnyder May 2, 2025

Choose a reason for hiding this comment

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

Ok I see, that makes sense! thanks, the code look good!

@Dhananjhay Dhananjhay merged commit 484431e into main May 2, 2025
6 checks passed
@Dhananjhay Dhananjhay deleted the mackenzie/add-wetrun-testing branch May 2, 2025 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants