parallax v1.0.0 Parallax

Simple module for orchestrating parallel tasks.

There are two basic abstractions for a Parallax operation, a Parallax.Graph.t, created by new/0, or a Parallax.Sequence.t, created by sequence/0. The latter allows you to tweak your own parallelism structure, while the graph infers an optimal parallelism strategy from the dependency DAG defined by subsequent calls to operation/4.

There are three main ways to add to sequences:

  • sync/3 - appends a task to be executed synchronously
  • parallel/3 - adds the task to be executed in parallel within the current batch
  • nest/3 - nests an existing Parallax.Executable within the current batch

To add to a graph, simply do Parallax.sync(graph, :name, fun, requires: :requirement) (also accepting a list of requirements)

To execute the operation, simply call Parallax.execute/1

All require a unique name so the result can be addressed after execution

Link to this section Summary

Functions

Nests another executable within the current batch. This is really just an alias to parallel, but distinct naming is there for clarity

Creates a new sequence with the given opts to pass along

Adds the operation to the current batch for parallelization

Appends a new batch to the sequence, and adds the given operation to it. Sequence ops are inherited

Link to this section Types

Link to this type executable()
executable() :: Parallax.Batch.t() | Parallax.Sequence.t() | (map() -> any())

Link to this section Functions

Link to this function execute(sequence)
Link to this function nest(seq, name, operation)

Nests another executable within the current batch. This is really just an alias to parallel, but distinct naming is there for clarity.

Link to this function new(args \\ %{}, opts \\ [])

Creates a new sequence with the given opts to pass along

Link to this function operation(graph, name, operation, requires \\ [])
Link to this function parallel(seq, name, operation)

Adds the operation to the current batch for parallelization.

Link to this function sequence(args \\ %{}, opts \\ [])
Link to this function sync(sequence, name, operation)

Appends a new batch to the sequence, and adds the given operation to it. Sequence ops are inherited.