WayScience / CP_Parallel

Traditionally, headless mode for CellProfiler can only run with one worker at a time with one set of images, which can take a long time sequentially. CP Parallel will run multiple instances of CellProfiler in parallel across plates.
BSD 3-Clause "New" or "Revised" License
0 stars 1 forks source link

Potential to add something as return for CP Parallel function #4

Open jenna-tomkinson opened 2 months ago

jenna-tomkinson commented 2 months ago

Consider returning something from this function - perhaps the logs or something which could be useful downstream. Doing this will help to chain together functionality here or where the function is implemented.

_Originally posted by @d33bs in https://github.com/WayScience/CP_Parallel/pull/1#discussion_r1736356420_

d33bs commented 2 months ago

This is often a common practice for functional programming styles. Generally functions which return something are easier to test (we can test the output) whereas imperative functions (ones which do not return anything) must be sometimes implicitly tested. Functions which return values are also generally easier to compose together with one another, encouraging reuse and growth patterns. In addition, functions which return values generally are easier to think through as they tell us about modified states of variables or other data (instead of modifying state implicitly leaving us to guess about what happened).

For the existing functions which leverage subprocess we're already dealing with a bit of implied state (relying on the Python sub-process to tell us about what happened to the CellProfiler run - which itself only provides logs and no direct control through the API). I'd suggest limiting further implied states where we can and adding useful output so the work may better grow over time.