This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| System.Net.WebException: The remote name could not be resolved: 'www.someunknownaddress' | |
| at Microsoft.FSharp.Control.WebExtensions.AsyncGetResponse@2036-1.Invoke(Exception _arg1) | |
| at [email protected](AsyncParams`1 args) | |
| at Cloud.Parallel[T](seq<Cloud<T>> computations) | |
| --- End of stack trace from previous location where exception was thrown --- | |
| в Microsoft.FSharp.Core.Operators.Raise[T](Exception exn) | |
| в <StartupCode$MBrace-Azure-Client>[email protected](Result`1 _arg2) | |
| в C:\Users\developer001\Source\Repos\MBrace.Azure\src\MBrace.Azure.Client\Process.fs:строка 116 | |
| в [email protected](a a) | |
| at MBrace.Continuation.ExceptionDispatchInfoUtils.Async.RunSync[T](FSharpAsync`1 workflow, FSharpOption`1 cancellationToken) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let maxContentLength = cloud { | |
| let lengthsJob = [|"https://github.com"; "https://www.microsoft.com"; "http://www.someunknownaddress"|] | |
| |> Array.map (getContentLenght >> Cloud.OfAsync) | |
| let! lengths = Cloud.Parallel lengthsJob | |
| return Array.max lengths | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| interface ICloudDisposable with | |
| member d.Dispose () = CloudDirectory.Delete(d, recursiveDelete = true) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /// Denotes handle to a distributable resource that can be disposed of. | |
| type ICloudDisposable = | |
| /// Releases any storage resources used by this object. | |
| abstract Dispose : unit -> Local<unit> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // initial creation of channel and ports | |
| let channel = cluster.StoreClient.Channel | |
| let sendPort1, receivePort1 = channel.Create<string>() | |
| let sendPort2, receivePort2 = channel.Create<string>() | |
| // cloud job gets incoming messaages from the receive port, does something | |
| // with received messages and sends the results to the send port | |
| let replicateMessage (receive : IReceivePort<string>) (send : ISendPort<string>) = | |
| cloud { | |
| while true do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let directory = cluster.StoreClient.FileStore.Directory.Create() | |
| let songFileNames = [|...|] // url addresses to the lyrics of the songs | |
| let download (url : string) = async { | |
| let http = new System.Net.WebClient() | |
| return! http.AsyncDownloadString(Uri url) | |
| } | |
| // to create new cloud file storing song's lyrics |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let songFiles = | |
| // url addresses to song lyrics are there | |
| // full sample here https://github.com/lenadroid/dotnetfringe/blob/master/azure/NetFringe/CloudFlows.fsx | |
| [| ... |] | |
| |> CloudFlow.ofArray | |
| |> CloudFlow.map download | |
| |> CloudFlow.filter (fun s -> s.Length > 300) | |
| |> CloudFlow.map (fun s -> s.Substring(0, s.IndexOf("\n") - 1)) | |
| |> CloudFlow.toArray | |
| |> cluster.CreateProcess |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let atomicValue = CloudAtom.New(42) |> cluster.Run | |
| let readAtomValue = atomicValue |> CloudAtom.Read |> cluster.Run | |
| cloud { | |
| do! | |
| [ for i in 1..1000 -> cloud { return! CloudAtom.Update (atomicValue, fun i -> i + 1) }] | |
| |> Cloud.Parallel | |
| |> Cloud.Ignore | |
| return! CloudAtom.Read atomicValue |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let vectorOfData = [| for i in 0 .. 1000 do for j in 0 .. i do yield (i,j) |] | |
| let cloudVector = CloudVector.New(vectorOfData,100000L) |> cluster.Run | |
| cloudVector.PartitionCount | |
| let lengthsJob = | |
| cloudVector | |
| |> CloudFlow.ofCloudVector | |
| |> CloudFlow.map (fun (a,b) -> a+b) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let data = "Some data" | |
| let cloudData = data |> CloudCell.New |> cluster.Run | |
| let lengthOfData = | |
| cloud { let! data = CloudCell.Read cloudData | |
| return data.Length } | |
| |> cluster.Run |