- imgs
- |> PSeq.map (fun (id, config, img) -> id, doAnalysis img id config (Some (fun p -> reportProgressImg id p)))
- |> PSeq.withDegreeOfParallelism n
- |> PSeq.toList
+ let results =
+ imgs
+ |> PSeq.choose (
+ fun (id, config, img) ->
+ match doAnalysis img id config (Some (fun p -> reportProgressImg id p)) with
+ | Some result -> Some (id, result)
+ | None -> None)
+ |> PSeq.withDegreeOfParallelism n
+ |> PSeq.toList
+
+ // If one of the analyses has been aborted we return 'None'.
+ if List.length results <> List.length imgs
+ then None
+ else Some results
+