Legend:
Library
Module
Module type
Parameter
Class
Class type
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.
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.
You have two options for implementing the worker process, a simple one and a deprecated one.
Simple option: just make sure worker_command is somewhere in the command hierarchy of the same executable in which start_master_server_exn is called, with a subcommand path equal to worker_command_args. It is possible for multiple calls to start_master_server_exn to share the same worker_command_args.
Deprecated option: implement something at least as complicated yourself using worker_init_before_async_exn and start_worker_server_exn. This option may go away in the future.
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.
start_worker_server_exn must be called in each spawned process. It is illegal to call both start_master_server_exn and start_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 and redirect_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.