View Source Cinema.Engine.Task (cinema v0.1.0)

The Cinema.Engine.Task module provides a simple implementation of the Cinema.Engine behaviour which uses the Task module to execute projections.

When in test mode, all Task functions will be executed synchronously. You can enable test mode by calling Cinema.Utils.Task.test_mode(true) somewhere before executing projections.

See the Cinema.Engine module for more details re: defining engines.

Summary

Functions

Executes the given Projection.t() using the Task engine. Returns {:ok, projection} if the projection was successfully executed, otherwise returns {:error, projection}.

Fetches the output of a Projection.t() which has been executed using Cinema.Engine.exec/2.

Functions

Link to this function

exec(projection, opts \\ [])

View Source

Executes the given Projection.t() using the Task engine. Returns {:ok, projection} if the projection was successfully executed, otherwise returns {:error, projection}.

You can fetch the output of the Projection.t() (assuming it was successfully executed) by passing the returned Projection.t() to Cinema.Projection.fetch/1 function.

Options

  • :timeout - The timeout to use when executing the projection. Defaults to 1 minute.
  • :skip_dependencies - Defaults to false. If true, skips executing the dependencies of the given projection. this is very useful for testing purposes where you use ExMachina to "mock" the results of all input projections.

Fetches the output of a Projection.t() which has been executed using Cinema.Engine.exec/2.