private async Task <(WitsmlLog sourceLog, WitsmlLog targetLog)> GetLogs(CopyLogDataJob job) { var sourceLog = WorkerTools.GetLog(witsmlSourceClient, job.SourceLogCurvesReference.LogReference, ReturnElements.HeaderOnly); var targetLog = WorkerTools.GetLog(witsmlClient, job.TargetLogReference, ReturnElements.HeaderOnly); await Task.WhenAll(sourceLog, targetLog); if (sourceLog.Result == null) { throw new Exception($"Could not find source log object: UidWell: {job.SourceLogCurvesReference.LogReference.WellUid}, " + $"UidWellbore: {job.SourceLogCurvesReference.LogReference.WellboreUid}, Uid: {job.SourceLogCurvesReference.LogReference.LogUid}"); } if (targetLog.Result == null) { throw new Exception($"Could not find target log object: UidWell: {job.SourceLogCurvesReference.LogReference.WellUid}, " + $"UidWellbore: {job.SourceLogCurvesReference.LogReference.WellboreUid}, Uid: {job.SourceLogCurvesReference.LogReference.LogUid}"); } return(sourceLog.Result, targetLog.Result); }
private async Task <Tuple <WitsmlLog[], WitsmlWellbore> > FetchSourceLogsAndTargetWellbore(CopyLogJob job) { var sourceLogReferenceList = job.Source.LogReferenceList; var getLogFromSourceQueries = Task.WhenAll(sourceLogReferenceList.Select(logReference => WorkerTools.GetLog(witsmlSourceClient, logReference, ReturnElements.All))); var getTargetWellboreQuery = WorkerTools.GetWellbore(witsmlClient, job.Target); await Task.WhenAll(getLogFromSourceQueries, getTargetWellboreQuery); var sourceLogs = await getLogFromSourceQueries; var targetWellbore = await getTargetWellboreQuery; return(Tuple.Create(sourceLogs, targetWellbore)); }