MBrace.Core and MBrace.Azure


Using MBrace on Azure

  1. Create an Azure account and download your publication settings file .

  2. Download or clone the starter pack.

  3. Build the solution to get the required packages
  4. Open the HandsOnTutorial/AzureCluster.fsx script. Insert the path to your publication settings file and edit any other Azure settings as required.

  5. Open the HandsOnTutorial/0-provision-azure-cluster.fsx script and follow the instruction up to the line

    1: 
    
     let deployment = Config.ProvisionCluster()
    

    Diagnostics will be shown. When created your cluster will now appear as a cloud service in the Azure management portal. If you have any trouble, report an issue on github.

  6. Open the first tutorial script in the starter pack hands-on tutorial (or read the online version). The scripts follow the tutorials in the Core Programming Model.

How your MBrace code runs on Azure

Your MBrace code has two parts: a client and a cluster. The cluster runs as an Azure Cloud Service with associated storage and queue assets. You can manage your cluster on the Azure management portal.

Typically your MBrace client will run in:

  • an F# interactive instance in your editor; or
  • as part of another cloud service, website or web job; or
  • as a client desktop process.

In all cases, the client will need sufficient network access to be able to write to the Azure storage and Service Bus accounts used by the MBrace runtime/cluster nodes.

When your client submits jobs using cluster.CreateProcess or cluster.Run, parts of your client code will be transported to the cluster and executed there. MBrace looks after the transport of code and data using Vagabond.

Take care that the base architectures on client and cluster are compatible, e.g. both are 64-bit.

Using your Azure cluster from compiled code

To use your Azure cluster from compiled projects (rather than scripts), add a reference to the MBrace.Azure package and use the following code. The configuration strings can be found by the Azure management console or the GetDeployment().Configuration in an MBrace data script.

1: 
2: 
3: 
4: 
5: 
6: 
let myStorageConnectionString = "..."
let myServiceBusConnectionString = "..."
let config = Configuration(myStorageConnectionString, myServiceBusConnectionString)
let cluster = AzureCluster.Connect(config, 
                                   logger = ConsoleLogger(true), 
                                   logLevel = LogLevel.Info)
namespace MBrace
namespace MBrace.Azure
val deployment : obj

Full name: azuretutorial.deployment
val myStorageConnectionString : string

Full name: Azure-tutorial.myStorageConnectionString
val myServiceBusConnectionString : string

Full name: Azure-tutorial.myServiceBusConnectionString
val config : Configuration

Full name: Azure-tutorial.config
Multiple items
type Configuration =
  new : storageConnectionString:string * serviceBusConnectionString:string -> Configuration
  member AssemblyContainer : string
  member CloudValueContainer : string
  member OptimizeClosureSerialization : bool
  member RuntimeContainer : string
  member RuntimeLogsTable : string
  member RuntimeTable : string
  member ServiceBusAccount : string
  member ServiceBusConnectionString : string
  member StorageAccount : string
  ...

Full name: MBrace.Azure.Configuration

--------------------
new : storageConnectionString:string * serviceBusConnectionString:string -> Configuration
val cluster : AzureCluster

Full name: Azure-tutorial.cluster
type AzureCluster =
  inherit MBraceClient
  private new : manager:ClusterManager * faultPolicy:FaultPolicy option -> AzureCluster
  member AttachLocalWorker : ?workerId:string * ?workingDirectory:string * ?maxWorkItems:int * ?logFile:string * ?logLevel:LogLevel * ?quiet:bool * ?heartbeatInterval:TimeSpan * ?heartbeatThreshold:TimeSpan * ?background:bool -> unit
  member AttachLocalWorkers : workerCount:int * ?maxWorkItems:int * ?logLevel:LogLevel * ?quiet:bool * ?heartbeatInterval:TimeSpan * ?heartbeatThreshold:TimeSpan * ?background:bool -> unit
  member CullNonResponsiveWorkers : heartbeatThreshold:TimeSpan -> unit
  member CullNonResponsiveWorkersAsync : heartbeatThreshold:TimeSpan -> Async<unit>
  member KillAllLocalWorkers : unit -> unit
  member KillLocalWorker : worker:IWorkerRef -> bool
  member Reset : ?deleteQueues:bool * ?deleteRuntimeState:bool * ?deleteLogs:bool * ?deleteUserData:bool * ?deleteAssemblyData:bool * ?force:bool * ?reactivate:bool -> unit
  member ResetAsync : ?deleteQueues:bool * ?deleteRuntimeState:bool * ?deleteLogs:bool * ?deleteUserData:bool * ?deleteAssemblyData:bool * ?force:bool * ?reactivate:bool -> Async<unit>
  ...

Full name: MBrace.Azure.AzureCluster
static member AzureCluster.Connect : config:Configuration * ?clientId:string * ?faultPolicy:MBrace.Core.FaultPolicy * ?logger:MBrace.Runtime.ISystemLogger * ?logLevel:LogLevel -> AzureCluster
static member AzureCluster.Connect : storageConnectionString:string * serviceBusConnectionString:string * ?clientId:string * ?faultPolicy:MBrace.Core.FaultPolicy * ?logger:MBrace.Runtime.ISystemLogger * ?logLevel:LogLevel -> AzureCluster
type ConsoleLogger = MBrace.Runtime.ConsoleLogger

Full name: MBrace.Azure.ConsoleLogger
type LogLevel = MBrace.Runtime.LogLevel

Full name: MBrace.Azure.LogLevel
MBrace.Runtime.LogLevel.Info: MBrace.Runtime.LogLevel = 4
Fork me on GitHub