public override async Task VerifyQuality( VerificationRequest request, IServerStreamWriter <VerificationResponse> responseStream, ServerCallContext context) { try { await StartRequest(request); Func <ITrackCancel, ServiceCallStatus> func = trackCancel => VerifyQualityCore(request, responseStream, trackCancel); ServiceCallStatus result = await GrpcServerUtils.ExecuteServiceCall( func, context, _staThreadScheduler); _msg.InfoFormat("Verification {0}", result); } catch (Exception e) { _msg.Error($"Error verifying quality for request {request}", e); SendFatalException(e, responseStream); SetUnhealthy(); } finally { EndRequest(); } }
public override async Task VerifyQuality( VerificationRequest request, IServerStreamWriter <VerificationResponse> responseStream, ServerCallContext context) { try { _msg.InfoFormat("Starting verification request from {0}", request.UserName); _msg.DebugFormat("Request details: {0}", request); if (Checkout3DAnalyst) { // It must be re-checked out (but somehow it's enough to do it // on the calling thread-pool thread!?) Ensure3dAnalyst(); } Func <ITrackCancel, ServiceCallStatus> func = trackCancel => VerifyQualityCore(request, responseStream, trackCancel); ServiceCallStatus result = await GrpcServerUtils.ExecuteServiceCall( func, context, _singleStaThreadScheduler); _msg.InfoFormat("Verification {0}", result); } catch (Exception e) { _msg.Error($"Error verifying quality for request {request}", e); SendFatalException(e, responseStream); SetUnhealthy(); } }
public override async Task VerifyStandaloneXml( StandaloneVerificationRequest request, IServerStreamWriter <StandaloneVerificationResponse> responseStream, ServerCallContext context) { try { _msg.InfoFormat("Starting stand-alone verification request from {0}", context.Peer); _msg.DebugFormat("Request details: {0}", request); Action <LoggingEvent> action = SendInfoLogAction(responseStream, ServiceCallStatus.Running); using (MessagingUtils.TemporaryRootAppender(new ActionAppender(action))) { Func <ITrackCancel, ServiceCallStatus> func = trackCancel => VerifyStandaloneXmlCore(request, responseStream, trackCancel); ServiceCallStatus result = await GrpcServerUtils.ExecuteServiceCall( func, context, _singleStaThreadScheduler); _msg.InfoFormat("Verification {0}", result); } } catch (Exception e) { _msg.Error($"Error verifying quality for request {request}", e); SendFatalException(e, responseStream); SetUnhealthy(); } }
public override async Task VerifyDataQuality( IAsyncStreamReader <DataVerificationRequest> requestStream, IServerStreamWriter <DataVerificationResponse> responseStream, ServerCallContext context) { VerificationRequest request = null; try { Assert.True(await requestStream.MoveNext(), "No request"); //while (await requestStream.MoveNext()) DataVerificationRequest initialrequest = Assert.NotNull(requestStream.Current, "No request"); request = initialrequest.Request; _msg.InfoFormat("Starting verification request from {0}", request); _msg.DebugFormat("Request details: {0}", request); if (Checkout3DAnalyst) { // It must be re-checked out (but somehow it's enough to do it // on the calling thread-pool thread!?) Ensure3dAnalyst(); } Func <DataVerificationResponse, DataVerificationRequest> moreDataRequest = delegate(DataVerificationResponse r) { return(Task.Run(async() => await RequestMoreDataAsync( requestStream, responseStream, context, r) .ConfigureAwait(false)) .Result); }; Func <ITrackCancel, ServiceCallStatus> func = trackCancel => VerifyDataQualityCore(initialrequest, moreDataRequest, responseStream, trackCancel); ServiceCallStatus result = await GrpcServerUtils.ExecuteServiceCall( func, context, _singleStaThreadScheduler); _msg.InfoFormat("Verification {0}", result); } catch (Exception e) { _msg.Error($"Error verifying quality for request {request}", e); SendFatalException(e, responseStream); SetUnhealthy(); } }
public override async Task VerifyDataQuality( IAsyncStreamReader <DataVerificationRequest> requestStream, IServerStreamWriter <DataVerificationResponse> responseStream, ServerCallContext context) { VerificationRequest request = null; try { Assert.True(await requestStream.MoveNext(), "No request"); DataVerificationRequest initialRequest = Assert.NotNull(requestStream.Current, "No request"); request = initialRequest.Request; await StartRequest(request); Func <DataVerificationResponse, DataVerificationRequest> moreDataRequest = delegate(DataVerificationResponse r) { return(Task.Run(async() => await RequestMoreDataAsync( requestStream, responseStream, context, r) .ConfigureAwait(false)) .Result); }; Func <ITrackCancel, ServiceCallStatus> func = trackCancel => VerifyDataQualityCore(initialRequest, moreDataRequest, responseStream, trackCancel); ServiceCallStatus result = await GrpcServerUtils.ExecuteServiceCall( func, context, _staThreadScheduler); _msg.InfoFormat("Verification {0}", result); } catch (Exception e) { _msg.Error($"Error verifying quality for request {request}", e); SendFatalException(e, responseStream); SetUnhealthy(); } finally { EndRequest(); } }
public override async Task <ShapeMsg> GetOpenJawReshapeLineReplaceEndPoint( OpenJawReshapeLineReplacementRequest request, ServerCallContext context) { Func <ITrackCancel, ShapeMsg> func = trackCancel => AdvancedReshapeServiceUtils.GetOpenJawReshapeReplaceEndPoint( request, trackCancel); ShapeMsg response = await GrpcServerUtils.ExecuteServiceCall(func, context, _staTaskScheduler, true) ?? new ShapeMsg(); return(response); }
public override async Task <AdvancedReshapeResponse> AdvancedReshape( AdvancedReshapeRequest request, ServerCallContext context) { Stopwatch watch = _msg.DebugStartTiming(); Func <ITrackCancel, AdvancedReshapeResponse> func = trackCancel => AdvancedReshapeServiceUtils.Reshape(request); AdvancedReshapeResponse response = await GrpcServerUtils.ExecuteServiceCall(func, context, _staTaskScheduler, true) ?? new AdvancedReshapeResponse(); _msg.DebugStopTiming(watch, "Reshaped for peer {0} ({1} source features)", context.Peer, request.Features.Count); return(response); }
public override async Task <RemoveOverlapsResponse> RemoveOverlaps( RemoveOverlapsRequest request, ServerCallContext context) { Stopwatch watch = _msg.DebugStartTiming(); Func <ITrackCancel, RemoveOverlapsResponse> func = trackCancel => RemoveOverlapsServiceUtils.RemoveOverlaps(request, trackCancel); RemoveOverlapsResponse response = await GrpcServerUtils.ExecuteServiceCall(func, context, _staTaskScheduler, true) ?? new RemoveOverlapsResponse(); _msg.DebugStopTiming(watch, "Removed overlaps for peer {0} ({1} source features)", context.Peer, request.SourceFeatures.Count); return(response); }
public override async Task <CalculateReshapeLinesResponse> CalculateReshapeLines( [NotNull] CalculateReshapeLinesRequest request, [NotNull] ServerCallContext context) { Stopwatch watch = _msg.DebugStartTiming(); Func <ITrackCancel, CalculateReshapeLinesResponse> func = trackCancel => ChangeAlongServiceUtils.CalculateReshapeLines(request, trackCancel); CalculateReshapeLinesResponse response = await GrpcServerUtils.ExecuteServiceCall(func, context, _staTaskScheduler, true) ?? new CalculateReshapeLinesResponse(); _msg.DebugStopTiming( watch, "Calculated reshape lines for peer {0} ({1} source features, {2}, target features)", context.Peer, request.SourceFeatures.Count, request.TargetFeatures.Count); return(response); }