package rpc_parallel

  1. Overview
  2. Docs

Module Rpc_parallelSource

A type-safe parallel library built on top of Async_rpc.

  module Worker = Rpc_parallel.Make (T : Worker_spec)

The Worker module can be used to spawn new workers, either locally or remotely, and run functions on these workers. T specifies which functions can be run on a Worker.t as well as the implementations for these functions. In addition, T specifies worker states and connection states. See README for more details

Sourcemodule Fd_redirection : sig ... end
Sourcemodule How_to_run : sig ... end
Sourcemodule Map_reduce : sig ... end

A parallel map/reduce library. See examples/add_numbers.ml and examples/number_stats.ml for examples.

Sourcemodule Prog_and_args : sig ... end
Sourcemodule Remote_executable : sig ... end
include module type of struct include Parallel end
Sourcemodule Function = Parallel.Function
Sourcemodule type Worker = Parallel.Worker
Sourcemodule type Functions = Parallel.Functions
Sourcemodule type Creator = Parallel.Creator
Sourcemodule type Worker_spec = Parallel.Worker_spec
Sourcemodule Make = Parallel.Make

module Worker = Make(T)

Sourceval start_app : ?rpc_max_message_size:int -> ?rpc_handshake_timeout:Core.Time.Span.t -> ?rpc_heartbeat_config:Async.Rpc.Connection.Heartbeat_config.t -> Async.Command.t -> unit

start_app command should be called from the top-level in order to start the parallel application. This function will parse certain environment variables and determine whether to start as a master or a worker.

rpc_max_message_size, rpc_handshake_timeout, rpc_heartbeat_config can be used to alter the rpc defaults. These rpc settings will be used for all connections. This can be useful if you have long async jobs.

Sourcemodule State = Parallel.State

Use State.get to query whether the current process has been initialized as an rpc parallel master (start_app or init_master_exn has been called). We return a State.t rather than a bool so that you can require evidence at the type level. If you want to certify, as a precondition, for some function that start_app was used, require a State.t as an argument. If you don't need the State.t anymore, just pattern match on it.

Sourcemodule For_testing = Parallel.For_testing
Sourcemodule Expert = 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.

Sourcemodule Managed = Parallel_managed

Rpc_parallel.Managed is a wrapper around Rpc_parallel that attempts to make manage connections for you, but it ended up being too magical to reason about, so you should prefer to use the plain Rpc_parallel interface.

Sourcemodule Std : sig ... end

Old Std style interface, which has slightly different module names.

Sourcemodule Parallel : sig ... end
Sourcemodule Parallel_managed : sig ... end
OCaml

Innovation. Community. Security.