Your First 'Hello World' Computation with MBrace
This tutorial is from the MBrace Starter Kit.
A guide to creating a cluster is here.
Start F# Interactive in your editor. Highlight the text below and press "Alt-Enter" (Visual Studio) or the other appropriate execution command for your editor. This connects to the cluster. If you are using a locally simulated cluster it also creates the cluster.
1:
|
|
Next, get details of the workers in your cluster. Again, highlight the text below and execute it in your scripting client:
1:
|
|
Now execute your first cloud workflow, returning a handle to the running job:
1: 2: 3: |
|
This submits a task to the cluster. To get details for the task, execute the following in your scripting client:
1:
|
|
Your task is likely complete by now. To get the result returned by your task, execute the following in your scripting client:
1:
|
|
Alternatively we can do this all in one line:
1: 2: 3: |
|
To check that you are running in the cloud, compare a workflow running locally with one using cloud execution. (Note, if using an MBrace.Thespian locally simulated cluster, these will be identical.)
1: 2: 3: 4: 5: 6: 7: |
|
Controlling the Cluster
To view the history of processes, execute the following line from your scriptin
1:
|
|
In case you run into trouble, you can clear all process records in the cluster by executing the following from your scripting client:
1:
|
|
Note, you can use the above techniques from both scripts and compiled projects. To see the components referenced by this script, see ThespianCluster.fsx or AzureCluster.fsx.
*
Full name: 1-hello-world.cluster
Full name: Config.GetCluster
Gets or creates a new Thespian cluster session.
Full name: 1-hello-world.task
Full name: 1-hello-world.text
Full name: 1-hello-world.quickText
Full name: 1-hello-world.localResult
Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.printfn
static member CommandLine : string
static member CurrentDirectory : string with get, set
static member Exit : exitCode:int -> unit
static member ExitCode : int with get, set
static member ExpandEnvironmentVariables : name:string -> string
static member FailFast : message:string -> unit + 1 overload
static member GetCommandLineArgs : unit -> string[]
static member GetEnvironmentVariable : variable:string -> string + 1 overload
static member GetEnvironmentVariables : unit -> IDictionary + 1 overload
static member GetFolderPath : folder:SpecialFolder -> string + 1 overload
...
nested type SpecialFolder
nested type SpecialFolderOption
Full name: System.Environment
Full name: 1-hello-world.remoteResult