Module Rpc_parallel.Expert
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 starting the master and worker rpc servers. 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 worker_init_before_async_exn
and then start_worker_server_exn
. An easy way to do this is to use worker_command
.
val start_master_server_exn : ?rpc_max_message_size:int -> ?rpc_handshake_timeout:Core.Time.Span.t -> ?rpc_heartbeat_config:Async.Rpc.Connection.Heartbeat_config.t -> ?pass_name:bool -> worker_command_args:string list -> unit -> unit
start_master_server_exn
must be called in the single master process. It is necessary to be able to spawn workers. Raises if the process was spawned.If
pass_name
isfalse
, the?name
argument to spawned workers will not be propagated into the worker's command line. This override is only needed to support the "deprecated option" for implementing worker commands described below.
val worker_command : Async.Command.t
module Worker_env : sig ... end
val worker_init_before_async_exn : unit -> Worker_env.t
worker_init_before_async_exn
must be called in a spawned worker process before the async scheduler has started. You must not read from stdin before this function call.This has the side effect of calling
chdir
.
val start_worker_server_exn : Worker_env.t -> unit
start_worker_server_exn
must be called in each spawned process. It is illegal to call bothstart_master_server_exn
andstart_worker_server_exn
in the same process. Raises if the process was not spawned.This has the side effect of scheduling a job that completes the daemonization of this process (if the process should daemonize). This includes redirecting stdout and stderr according to
redirect_stdout
andredirect_stderr
. All writes to stdout before this job runs are blackholed. All writes to stderr before this job runs are redirected to the spawning process's stderr.