If you want more direct control over your executable, you can use the Expert
module instead of start_app
. If you use Expert
, you are responsible for
initializing the master service or running the worker. worker_command_args
will be
the arguments sent to each spawned worker. Running your executable with these args
must follow a code path that calls run_as_worker_exn
.
init_master_exn
should be called in the single master process. It is necessary to
be able to spawn workers.
run_as_worker_exn
is the entry point for all workers. It is illegal to call both
init_master_exn
and run_as_worker_exn
in the same process. Will also raise an
exception if the process was not spawned by a master.
NOTE: Various information is sent from the master to the spawned worker as a sexp
through its stdin. A spawned worker should *never* read from stdin before calling
run_as_worker_exn
.