MBrace


MBrace framework

The MBrace framework is an open-source distributed runtime that enables scalable, fault-tolerant computation and data processing for the .NET/mono frameworks. The MBrace programming model uses a distributed continuation-based approach elegantly manifested through computation expressions in F#.

A prerelease of MBrace can be installed from NuGet:
PM> Install-Package MBrace.Runtime -Pre

Example

An MBrace session can be initialized from F# interactive as follows:

 1: 
 2: 
 3: 
 4: 
 5: 
 6: 
 7: 
 8: 
 9: 
10: 
11: 
12: 
13: 
14: 
15: 
16: 
17: 
18: 
19: 
20: 
21: 
22: 
23: 
24: 
#load "../packages/MBrace.Runtime/bootstrap.fsx"

open Nessos.MBrace
open Nessos.MBrace.Client

[<Cloud>]
let lineCount () = cloud {
    // enumerate all files from underlying storage container
    let! files = CloudFile.Enumerate "path/to/container"

    // read the contents of a file and return its line count
    let count f = cloud {
        let! text = CloudFile.ReadAllText f
        return text.Split('\n').Length
    }
    
    // perform line count in parallel
    let! sizes = files |> Array.map count |> Cloud.Parallel
    return Array.sum sizes
}

let runtime = MBrace.Connect("192.168.0.40", port = 2675) // connect to an MBrace runtime
let proc = runtime.CreateProcess <@ lineCount () @> // send computation to the runtime
let lines = proc.AwaitResult () // await completion

For a quick dive into MBrace and applications, check out the MBrace.Demos solution.

git clone https://github.com/nessos/MBrace.Demos

Documentation & Tutorials

A collection of tutorials, technical overviews and API references of the library.

Contributing and copyright

The project is hosted on GitHub where you can report issues, fork the project and submit pull requests.

The library is available under the Apache License. For more information see the License file in the GitHub repository.

namespace Nessos
namespace Nessos.MBrace
namespace Nessos.MBrace.Lib
namespace Nessos.MBrace.Client
Multiple items
module Cloud

from Nessos.MBrace.Lib

--------------------
type Cloud =
  static member Catch : computation:Cloud<'T> -> Cloud<Choice<'T,exn>>
  static member Choice : computations:seq<Cloud<'T option>> -> Cloud<'T option>
  static member Dispose : resource:#ICloudDisposable -> Cloud<unit>
  static member GetProcessId : unit -> Cloud<ProcessId>
  static member GetTaskId : unit -> Cloud<string>
  static member GetWorkerCount : unit -> Cloud<int>
  static member Ignore : computation:Cloud<'T> -> Cloud<unit>
  static member Log : msg:string -> Cloud<unit>
  static member Logf : fmt:StringFormat<'a0,Cloud<unit>> -> 'a0
  static member OfAsync : asyncComputation:Async<'T> -> Cloud<'T>
  ...

Full name: Nessos.MBrace.Cloud

--------------------
type Cloud<'T> =
  private new : cloudExpr:CloudExpr -> Cloud<'T>
  member private CloudExpr : CloudExpr
  member Type : Type

Full name: Nessos.MBrace.Cloud<_>

--------------------
type CloudAttribute = ReflectedDefinitionAttribute

Full name: Nessos.MBrace.CloudAttribute
val lineCount : unit -> Cloud<int>

Full name: Index.lineCount
val cloud : CloudBuilder

Full name: Nessos.MBrace.CloudBuilder.cloud
val files : ICloudFile []
type CloudFile =
  static member Enumerate : container:string -> Cloud<ICloudFile []>
  static member Get : container:string * name:string -> Cloud<ICloudFile>
  static member New : serializer:(Stream -> Async<unit>) -> Cloud<ICloudFile>
  static member New : container:string * serializer:(Stream -> Async<unit>) -> Cloud<ICloudFile>
  static member New : container:string * name:string * serializer:(Stream -> Async<unit>) -> Cloud<ICloudFile>
  static member Read : cloudFile:ICloudFile * deserialize:(Stream -> Async<'Result>) -> Cloud<'Result>
  static member TryGet : container:string * name:string -> Cloud<ICloudFile option>

Full name: Nessos.MBrace.CloudFile
static member CloudFile.Enumerate : container:string -> Cloud<ICloudFile []>
val count : (ICloudFile -> Cloud<int>)
val f : ICloudFile
val text : string
static member CloudFile.ReadAllText : file:ICloudFile * ?encoding:System.Text.Encoding -> Cloud<string>
System.String.Split(params separator: char []) : string []
System.String.Split(separator: string [], options: System.StringSplitOptions) : string []
System.String.Split(separator: char [], options: System.StringSplitOptions) : string []
System.String.Split(separator: char [], count: int) : string []
System.String.Split(separator: string [], count: int, options: System.StringSplitOptions) : string []
System.String.Split(separator: char [], count: int, options: System.StringSplitOptions) : string []
val sizes : int []
module Array

from Microsoft.FSharp.Collections
val map : mapping:('T -> 'U) -> array:'T [] -> 'U []

Full name: Microsoft.FSharp.Collections.Array.map
static member Cloud.Parallel : computations:seq<Cloud<'T>> -> Cloud<'T []>
val sum : array:'T [] -> 'T (requires member ( + ) and member get_Zero)

Full name: Microsoft.FSharp.Collections.Array.sum
val runtime : MBraceRuntime

Full name: Index.runtime
type MBrace =
  static member Compile : block:Cloud<'T> * ?name:string -> CloudComputation<'T>
  static member Compile : expr:Expr<Cloud<'T>> * ?name:string -> CloudComputation<'T>
  static member CreateProcess : runtime:MBraceRuntime -> expr:Expr<Cloud<'T>> -> Process<'T>
  static member CreateProcessAsync : runtime:MBraceRuntime -> expr:Expr<Cloud<'T>> -> Async<Process<'T>>
  static member RunLocal : computation:Expr<Cloud<'T>> * ?showLogs:bool -> 'T
  static member RunLocal : computation:Cloud<'T> * ?showLogs:bool -> 'T
  static member RunLocal : computation:CloudComputation<'T> * ?showLogs:bool -> 'T
  static member RunLocalAsync : expr:Expr<Cloud<'T>> * ?showLogs:bool -> Async<'T>
  static member RunLocalAsync : computation:Cloud<'T> * ?showLogs:bool -> Async<'T>
  static member RunLocalAsync : computation:CloudComputation<'T> * ?showLogs:bool -> Async<'T>
  ...

Full name: Nessos.MBrace.Client.ClientExtensions.MBrace
static member MBraceRuntime.Connect : uri:string -> MBraceRuntime
static member MBraceRuntime.Connect : uri:System.Uri -> MBraceRuntime
static member MBraceRuntime.Connect : host:string * port:int -> MBraceRuntime
val proc : Process<int>

Full name: Index.proc
member MBraceRuntime.CreateProcess : computation:Runtime.Compiler.CloudComputation<'T> -> Process<'T>
member MBraceRuntime.CreateProcess : block:Cloud<'T> * ?name:string -> Process<'T>
member MBraceRuntime.CreateProcess : expr:Quotations.Expr<Cloud<'T>> * ?name:string -> Process<'T>
val lines : int

Full name: Index.lines
member Process.AwaitResult : ?pollingInterval:int -> 'T
Fork me on GitHub