scrape v3.1.0 Scrape.Flow
Logic Module for implementing linear data processing workflows.
Uses a "token" approach to store/retrieve values and persists a pipeline state that can be halted at any time. In case that something goes wrong, the pipeline will be halted and an error object will be returned with the occured error. Therefore, the pipeline should never raise an actual exception.
Link to this section Summary
Types
Intermediate state object that holds everything relevant for the data
processing work flow. state
holds general processing information, assigns
are the user-level data fields and options
contains a keyword list for,
well, configuration options.
Functions
Declare a new value in the data flow.
Select keys from the flow assigns and return a map with the chosen fields.
Initiate a new data processing flow with optional configuration.
Link to this section Types
flow()
Intermediate state object that holds everything relevant for the data
processing work flow. state
holds general processing information, assigns
are the user-level data fields and options
contains a keyword list for,
well, configuration options.
Link to this section Functions
assign(flow, arg2)
Declare a new value in the data flow.
Will do nothing if the flow got halted previously. If a function is given, and it raises an exception, the pipeline will catch the error and transform into a halted state.
finish(flow, keys \\ [])
Select keys from the flow assigns and return a map with the chosen fields.
Will result in an error object if the flow got halted previously.
start(opts \\ [])
Initiate a new data processing flow with optional configuration.
NOTE: the options are currently not used but will be in upcoming versions.
Example
iex> Flow.start()
%Flow{state: %{halted: false, error: nil}, assigns: %{}, options: []}