MBrace.Core and MBrace.Azure


 1: 
 2: 
 3: 
 4: 
 5: 
 6: 
 7: 
 8: 
 9: 
10: 
11: 
12: 
13: 
14: 
15: 
16: 
17: 
18: 
19: 
20: 
21: 
22: 
23: 
24: 
25: 
26: 
27: 
28: 
29: 
30: 
31: 
32: 
33: 
34: 
35: 
36: 
37: 
38: 
39: 
40: 
41: 
42: 
43: 
44: 
45: 
46: 
47: 
48: 
49: 
50: 
51: 
52: 
53: 
54: 
55: 
56: 
57: 
58: 
59: 
60: 
61: 
62: 
63: 
64: 
65: 
66: 
67: 
68: 
69: 
70: 
71: 
72: 
73: 
74: 
75: 
76: 
77: 
78: 
79: 
#I __SOURCE_DIRECTORY__
#I "../packages/MBrace.Azure/tools" 
#I "../packages/Streams/lib/net45" 
#r "../packages/Streams/lib/net45/Streams.dll"
#I "../packages/MBrace.Flow/lib/net45" 
#r "../packages/MBrace.Flow/lib/net45/MBrace.Flow.dll"
#load "../packages/MBrace.Azure/MBrace.Azure.fsx"
#load "../packages/MBrace.Azure.Management/MBrace.Azure.Management.fsx"

namespace global

module Config =

    open System.IO
    open MBrace.Core
    open MBrace.Runtime
    open MBrace.Azure
    open MBrace.Azure.Management

    // This script is used to reconnect to your cluster.

    // You can download your publication settings file at 
    //     https://manage.windowsazure.com/publishsettings
    let pubSettingsFile = @"C:\path\to\your.publishsettings"

    // If your publication settings defines more than one subscription,
    // you will need to specify which one you will be using here.
    let subscriptionId : string option = None

    // Your prefered Azure service name for the cluster.
    // NB: must be a valid DNS prefix unique across Azure.
    let clusterName = "enter a valid and unique cloud service name"

    // Your prefered Azure region. Assign this to a data center close to your location.
    let region = Region.North_Europe
    // Your prefered VM size
    let vmSize = VMSize.Large
    // Your prefered cluster count
    let vmCount = 4

    // set to true if you would like to provision
    // the custom cloud service bundled with the StarterKit
    // In order to use this feature, you will need to open
    // the `CustomCloudService` solution under the `azure` folder 
    // inside the MBrace.StarterKit repo.
    // Right click on the cloud service item and hit "Package.."
    let useCustomCloudService = false
    let private tryGetCustomCsPkg () =
        if useCustomCloudService then
            let path = __SOURCE_DIRECTORY__ + "/../azure/CustomCloudService/bin/app.publish/MBrace.Azure.CloudService.cspkg" |> Path.GetFullPath
            if not <| File.Exists path then failwith "Find the 'MBrace.Azure.CloudService' project under 'azure\CustomCloudService' and hit 'Package...'."
            Some path
        else
            None

    let GetSubscriptionManager() = 
        SubscriptionManager.FromPublishSettingsFile(pubSettingsFile, region, ?subscriptionId = subscriptionId, logger = new ConsoleLogger())

    /// Gets the already existing deployment
    let GetDeployment() = GetSubscriptionManager().GetDeployment(clusterName) 

    /// Provisions a new cluster to Azure with supplied parameters
    let ProvisionCluster() = 
        GetSubscriptionManager().Provision(vmCount, serviceName = clusterName, vmSize = vmSize, ?cloudServicePackage = tryGetCustomCsPkg())

    /// Resizes the cluster using an updated VM count
    let ResizeCluster(newVmCount : int) =
        let deployment = GetDeployment()
        deployment.Resize(newVmCount)

    /// Deletes an existing cluster deployment
    let DeleteCluster() =
        let deployment = GetDeployment()
        deployment.Delete()

    /// Connect to the cluster 
    let GetCluster() = 
        let deployment = GetDeployment()
        AzureCluster.Connect(deployment, logger = ConsoleLogger(true), logLevel = LogLevel.Info)
module Config
namespace System
namespace System.IO
namespace MBrace
namespace MBrace.Core
namespace MBrace.Runtime
namespace MBrace.Azure
namespace MBrace.Azure.Management
val pubSettingsFile : string

Full name: Config.pubSettingsFile
val subscriptionId : string option

Full name: Config.subscriptionId
Multiple items
val string : value:'T -> string

Full name: Microsoft.FSharp.Core.Operators.string

--------------------
type string = System.String

Full name: Microsoft.FSharp.Core.string
type 'T option = Option<'T>

Full name: Microsoft.FSharp.Core.option<_>
union case Option.None: Option<'T>
val clusterName : string

Full name: Config.clusterName
val region : Region

Full name: Config.region
type Region =
  private new : regionId:string -> Region
  override Equals : other:obj -> bool
  override GetHashCode : unit -> int
  override ToString : unit -> string
  member Id : string
  static member Define : regionId:string -> Region
  static member Central_US : Region
  static member East_Asia : Region
  static member East_US : Region
  static member East_US_2 : Region
  ...

Full name: MBrace.Azure.Management.Region
property Region.North_Europe: Region
val vmSize : VMSize

Full name: Config.vmSize
type VMSize =
  private new : vmId:string -> VMSize
  override Equals : other:obj -> bool
  override GetHashCode : unit -> int
  override ToString : unit -> string
  member Id : string
  static member Define : vmId:string -> VMSize
  static member A1 : VMSize
  static member A10 : VMSize
  static member A11 : VMSize
  static member A2 : VMSize
  ...

Full name: MBrace.Azure.Management.VMSize
property VMSize.Large: VMSize
val vmCount : int

Full name: Config.vmCount
val useCustomCloudService : bool

Full name: Config.useCustomCloudService
val private tryGetCustomCsPkg : unit -> string option

Full name: Config.tryGetCustomCsPkg
val path : string
type Path =
  static val DirectorySeparatorChar : char
  static val AltDirectorySeparatorChar : char
  static val VolumeSeparatorChar : char
  static val InvalidPathChars : char[]
  static val PathSeparator : char
  static member ChangeExtension : path:string * extension:string -> string
  static member Combine : [<ParamArray>] paths:string[] -> string + 3 overloads
  static member GetDirectoryName : path:string -> string
  static member GetExtension : path:string -> string
  static member GetFileName : path:string -> string
  ...

Full name: System.IO.Path
Path.GetFullPath(path: string) : string
val not : value:bool -> bool

Full name: Microsoft.FSharp.Core.Operators.not
type File =
  static member AppendAllLines : path:string * contents:IEnumerable<string> -> unit + 1 overload
  static member AppendAllText : path:string * contents:string -> unit + 1 overload
  static member AppendText : path:string -> StreamWriter
  static member Copy : sourceFileName:string * destFileName:string -> unit + 1 overload
  static member Create : path:string -> FileStream + 3 overloads
  static member CreateText : path:string -> StreamWriter
  static member Decrypt : path:string -> unit
  static member Delete : path:string -> unit
  static member Encrypt : path:string -> unit
  static member Exists : path:string -> bool
  ...

Full name: System.IO.File
File.Exists(path: string) : bool
val failwith : message:string -> 'T

Full name: Microsoft.FSharp.Core.Operators.failwith
union case Option.Some: Value: 'T -> Option<'T>
val GetSubscriptionManager : unit -> SubscriptionManager

Full name: Config.GetSubscriptionManager
type SubscriptionManager =
  private new : client:SubscriptionClient * defaultRegion:Region * _logger:ISystemLogger * logLevel:LogLevel -> SubscriptionManager
  member AttachLogger : l:ISystemLogger -> IDisposable
  member DeleteDeployment : serviceName:string * ?deleteStorageAccount:bool * ?deleteServiceBusAccount:bool -> unit
  member DeleteDeploymentAsync : serviceName:string * ?deleteStorageAccount:bool * ?deleteServiceBusAccount:bool -> Async<unit>
  member GetDeployment : serviceName:string -> Deployment
  member GetDeploymentAsync : serviceName:string -> Async<Deployment>
  member GetDeployments : unit -> Deployment []
  member GetDeploymentsAsync : unit -> Async<Deployment []>
  member Provision : vmCount:int * ?serviceName:string * ?region:Region * ?vmSize:VMSize * ?mbraceVersion:string * ?storageAccount:string * ?serviceBusAccount:string * ?cloudServicePackage:string * ?clusterLabel:string * ?enableDiagnostics:bool * ?reuseAccounts:bool -> Deployment
  member ProvisionAsync : vmCount:int * ?serviceName:string * ?region:Region * ?vmSize:VMSize * ?mbraceVersion:string * ?storageAccount:string * ?serviceBusAccount:string * ?cloudServicePackage:string * ?clusterLabel:string * ?enableDiagnostics:bool * ?reuseAccounts:bool -> Async<Deployment>
  ...

Full name: MBrace.Azure.Management.SubscriptionManager
static member SubscriptionManager.FromPublishSettingsFile : publishSettingsFile:string * defaultRegion:Region * ?subscriptionId:string * ?logger:ISystemLogger * ?logLevel:LogLevel -> SubscriptionManager
type ConsoleLogger = ConsoleLogger

Full name: MBrace.Azure.Management.ConsoleLogger
val GetDeployment : unit -> Deployment

Full name: Config.GetDeployment


 Gets the already existing deployment
val ProvisionCluster : unit -> Deployment

Full name: Config.ProvisionCluster


 Provisions a new cluster to Azure with supplied parameters
val ResizeCluster : newVmCount:int -> unit

Full name: Config.ResizeCluster


 Resizes the cluster using an updated VM count
val newVmCount : int
Multiple items
val int : value:'T -> int (requires member op_Explicit)

Full name: Microsoft.FSharp.Core.Operators.int

--------------------
type int = int32

Full name: Microsoft.FSharp.Core.int

--------------------
type int<'Measure> = int

Full name: Microsoft.FSharp.Core.int<_>
val deployment : Deployment
member Deployment.Resize : vmCount:int -> unit
val DeleteCluster : unit -> unit

Full name: Config.DeleteCluster


 Deletes an existing cluster deployment
member Deployment.Delete : ?deleteStorageAccount:bool * ?deleteServiceBusAccount:bool -> unit
val GetCluster : unit -> AzureCluster

Full name: Config.GetCluster


 Connect to the 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 : deployment:Deployment * ?clientId:string * ?faultPolicy:MBrace.Core.FaultPolicy * ?logger:ISystemLogger * ?logLevel:LogLevel -> AzureCluster
static member AzureCluster.Connect : config:Configuration * ?clientId:string * ?faultPolicy:MBrace.Core.FaultPolicy * ?logger:ISystemLogger * ?logLevel:LogLevel -> AzureCluster
static member AzureCluster.Connect : storageConnectionString:string * serviceBusConnectionString:string * ?clientId:string * ?faultPolicy:MBrace.Core.FaultPolicy * ?logger:ISystemLogger * ?logLevel:LogLevel -> AzureCluster
Multiple items
module LogLevel

from MBrace.Runtime

--------------------
type LogLevel = LogLevel

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