striot-0.1.1.0
Copyright© StrIoT maintainers 2021
LicenseApache 2.0
MaintainerStrIoT maintainers
Stabilityexperimental
Safe HaskellSafe-Inferred
LanguageHaskell2010

Striot.Orchestration

Description

The highest-level StrIoT interfaces, for transforming and partitioning programs described as StreamGraphs.

Synopsis

Documentation

type Plan = (StreamGraph, PartitionMap) Source #

A Plan is a pairing of a StreamGraph with a PartitionMap that could be used for its partitioning and deployment.

type Cost = Maybe Int Source #

The Cost of a Plan (lower is better). Nothing represents a non-viable pairing. Maybe n represents the cost n.

distributeProgram :: GenerateOpts -> StreamGraph -> IO () Source #

Apply rewrite rules to the supplied StreamGraph to possibly rewrite it; partition it when a generated PartitionMap; generate and write out Haskell source code files for each Partition, ready for deployment.

chopAndChange :: GenerateOpts -> StreamGraph -> Plan Source #

apply viableRewrites to the supplied StreamGraph. Return the lowest-cost Plan. If there are no pairings, throw an error.

TODO: rename this. It's a bad name! optimiseChoosePartitionMap?

viableRewrites :: GenerateOpts -> StreamGraph -> [(Plan, Cost)] Source #

Given a stream processing program encoded in a StreamGraph:

  • generate derivative graphs via rewrite rules.
  • generate all possible partitionings for each graph
  • for each pair of graph and partitioning (Plan):

    • reject any pairings which are not viable
    • Cost the pairs with the cost model planCost
  • return the Plan paired with with the Cost from applying the cost model.

deriveRewritesAndPartitionings :: [RewriteRule] -> StreamGraph -> [Plan] Source #

given a StreamGraph, derives further graphs by applying rewrite rules and pairs them with all their potential partitionings

allPartitionsPaired :: StreamGraph -> [Plan] Source #

given a StreamGraph, generate all partitionings of it and pair them individually with the StreamGraph.

planCost :: GenerateOpts -> Plan -> Cost Source #

Return a Cost for a Plan. Return Nothing if the Plan is not viable, either due to an over-utilised operator or an over-utilised Partition.

CompileIoT functions

Functions re-exported from CompileIoT.

simpleStream :: [(StreamOperator, [ExpQ], String, Double)] -> Graph StreamVertex Source #

Convenience function for specifying a simple path-style of stream processing program, with no merge or join operations. The list of tuples are converted into a series of connected Stream Vertices in a Graph. The tuple arguments are the relevant StreamOperator for the node; the parameters;the *output* type and the service time. The other parameters to StreamVertex are inferred from the neighbouring tuples. Unique and ascending vertexId values are assigned.

partitionGraph :: StreamGraph -> PartitionMap -> GenerateOpts -> IO () Source #

Partitions the supplied StreamGraph according to the supplied PartitionMap; invokes generateCode for each derived sub-graph; writes out the resulting source code to individual source code files, one per node.

  • TODO*: move GenerateOpts to first parameter?

data GenerateOpts Source #

Options for source code generation are captured in instances of the GenerateOpts data-type.

Constructors

GenerateOpts 

Fields

defaultOpts :: GenerateOpts Source #

Sensible default values for GenerateOpts. Users who wish to customise options in GenerateOpts are encouraged to derive from defaultOpts.