This is a preliminary PR with an executor for running tasks within local conda environments. I'll be curious to hear your feedback on it!
Overview of function
Similar to the Batch executor in debug=True mode, we construct a command to call redun oneshot for tasks (or for scripts, we just use redun's existing script preparation). Then we pass that command to conda run, conda's non-interactive execution entrypoint. We maintain a pool of thread workers to actually run the commands in a subprocess and post-process the results.
Some points of discussion
I think it ought to be possible to abstract most of the machinery here into a more generic "local custom shell executor". Then you could support conda, arbitrary local virtual envs, local docker or other containers, etc.
I wasn't able to reuse any existing utility code for constructing the oneshot commands, due to how redun.executors.aws_batch.submit_task() is currently factored. However, my implementation is heavily inspired by what the batch executor does. I'd be happy to try refactoring things a bit in the interest of unification.
Have not added tests yet. I assume you don't want to add conda as a dependency so I'm planning to mock the actual subprocess calls.
Happy to answer any questions and open to all suggestions.
Greetings @mattrasmus and team!
This is a preliminary PR with an executor for running tasks within local conda environments. I'll be curious to hear your feedback on it!
Overview of function
Similar to the Batch executor in
debug=True
mode, we construct a command to callredun oneshot
for tasks (or for scripts, we just use redun's existing script preparation). Then we pass that command toconda run
, conda's non-interactive execution entrypoint. We maintain a pool of thread workers to actually run the commands in a subprocess and post-process the results.Some points of discussion
I think it ought to be possible to abstract most of the machinery here into a more generic "local custom shell executor". Then you could support conda, arbitrary local virtual envs, local docker or other containers, etc.
I wasn't able to reuse any existing utility code for constructing the oneshot commands, due to how
redun.executors.aws_batch.submit_task()
is currently factored. However, my implementation is heavily inspired by what the batch executor does. I'd be happy to try refactoring things a bit in the interest of unification.Have not added tests yet. I assume you don't want to add
conda
as a dependency so I'm planning to mock the actual subprocess calls.Happy to answer any questions and open to all suggestions.
Cheers! Dan Spitz