Up

Module 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 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.

Signature

val init_master_exn : ?rpc_max_message_size:int -> ?rpc_handshake_timeout:Core.Std.Time.Span.t -> ?rpc_heartbeat_config:Async.Std.Rpc.Connection.Heartbeat_config.t -> worker_command_args:string list -> unit -> unit

init_master_exn should be called in the single master process. It is necessary to be able to spawn workers.

val run_as_worker_exn : unit -> Core.Std.never_returns

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.