Dune's process execution engine

Dune handles invocation of the compiler and other tools and has to wait for results all while maximising parallelism. Has this process execution engine been extracted and used outside of Dune?

1 Like

It has not been extracted. It’s quite a simple mechanism and all the secret sauce exists in two modules:

  • Fiber - In particular Fiber.Throttle is what we use to enforce -j.
  • Scheduler - Handles waiting for processes and signalling this to Fiber.Throttle.

You should be able to adapt to your own application easily if you want to.

3 Likes

I also like the process.ml - because I would like to execute external commands much like Dune.

1 Like

That’s true. Just note that process.ml mostly deals with stdin/stdout/stderr redirection and proper logging of commands executed by dune. You should just as easily be able to use the process creation functions in Unix in your application.

2 Likes