package async_parallel

  1. Overview
  2. Docs
exception Error_initializing_worker_machine of string * exn
include sig ... end
val init : ?cluster:Import.Cluster.t -> ?close_stdout_and_stderr:bool -> unit -> Core.Pid.t

init initializes the system and creates the master process. master_init, if specified, is called in the master process and may be used for cleanup/initialization such as closing file descriptors. init should be called before any threads are created. If your program daemonizes, call init after you daemonize, but before you start the async scheduler. init may only be called once.

If cluster is specified, and it specifies a set of host names or ips that you can ssh to without a password, and have permission to run programs on, then a master process will also be started on these machines, and you will be able to spawn worker processes on these machines. The current machine is implicitly included in the set of available machines.

All the functions below are called in either the main process or a worker process.

val create_process : ?where:[ `Local | `On of string | `F of unit -> string ] -> unit -> (Async.Unix.Inet_addr.t * int) Core.Or_error.t Async.Deferred.t

Request a new process. Returns the ip/port where the new process may be reached. If specified where determines which machine the process will be spawned on, the default is `Local (the current machine).

val shutdown : unit -> unit Async.Deferred.t

Tell the master process to shutdown.

val round_robin : [> `F of unit -> string ]
val random : [> `F of unit -> string ]
val random_in : string list -> [> `F of unit -> string ]
OCaml

Innovation. Community. Security.