public GriddedReportRequestResponse Invoke(GriddedReportRequestArgument arg) { _log.LogInformation("In GridRequestComputeFunc.Invoke()"); try { // Supply the TRex ID of the Ignite node currently running this code to permit processing contexts to send // sub grid results to it. arg.TRexNodeID = TRexNodeID.ThisNodeID(StorageMutability.Immutable); _log.LogInformation($"Assigned TRexNodeId from local node is {arg.TRexNodeID}"); var request = new GriddedReportComputeFuncExecutor(arg); _log.LogInformation("Executing request.ExecuteAsync()"); if (!request.ExecuteAsync().WaitAndUnwrapException()) { _log.LogError("Request execution failed"); } return(request.GriddedReportRequestResponse); } catch (Exception e) { _log.LogError(e, "Exception occurred in GriddedReportRequestComputeFunc.Invoke()"); return(new GriddedReportRequestResponse { ResultStatus = Types.RequestErrorStatus.Exception }); } finally { _log.LogInformation("Exiting GridRequestComputeFunc.Invoke()"); } }
public TINSurfaceResult Invoke(TINSurfaceRequestArgument arg) { _log.LogInformation("In TINSurfaceRequestComputeFunc.Invoke()"); try { // Export requests can be a significant resource commitment. Ensure TPaaS will be listening... PerformTPaaSRequestLivelinessCheck(arg); // Supply the TRex ID of the Ignite node currently running this code to permit processing contexts to send // sub grid results to it. arg.TRexNodeID = TRexNodeID.ThisNodeID(StorageMutability.Immutable); _log.LogInformation($"Assigned TRexNodeId from local node is {arg.TRexNodeID}"); var request = new TINSurfaceExportExecutor(arg.ProjectID, arg.Filters, arg.Tolerance, arg.TRexNodeID, arg.LiftParams); _log.LogInformation("Executing request.ExecuteAsync()"); if (!request.ExecuteAsync().WaitAndUnwrapException()) { _log.LogError("Request execution failed"); } var result = new TINSurfaceResult(); using var ms = RecyclableMemoryStreamManagerHelper.Manager.GetStream(); if (request.SurfaceSubGridsResponse.TIN != null) { request.SurfaceSubGridsResponse.TIN.SaveToStream(Consts.DefaultCoordinateResolution, Consts.DefaultElevationResolution, false, ms); result.data = ms.ToArray(); } return(result); } catch (Exception e) { _log.LogError(e, "Exception requesting a TTM surface"); return(new TINSurfaceResult { ResultStatus = Types.RequestErrorStatus.Exception }); } finally { _log.LogInformation("Exiting TINSurfaceRequestComputeFunc.Invoke()"); } }
public PatchRequestResponse Invoke(PatchRequestArgument arg) { _log.LogInformation("In PatchRequestComputeFunc.Invoke()"); try { // Export requests can be a significant resource commitment. Ensure TPaaS will be listening... PerformTPaaSRequestLivelinessCheck(arg); // Supply the TRex ID of the Ignite node currently running this code to permit processing contexts to send // sub grid results to it. arg.TRexNodeID = TRexNodeID.ThisNodeID(StorageMutability.Immutable); _log.LogInformation($"Assigned TRexNodeId from local node is {arg.TRexNodeID}"); var request = new PatchExecutor(arg.ProjectID, arg.Mode, arg.Filters, arg.ReferenceDesign, arg.TRexNodeID, arg.DataPatchNumber, arg.DataPatchSize, arg.LiftParams); _log.LogInformation("Executing request.ExecuteAsync()"); if (!request.ExecuteAsync().WaitAndUnwrapException()) { _log.LogError("Request execution failed"); } return(request.PatchSubGridsResponse); } catch (Exception e) { _log.LogError(e, "Exception requesting patch"); return(new PatchRequestResponse { ResultStatus = Types.RequestErrorStatus.Exception }); } finally { _log.LogInformation("Exiting PatchRequestComputeFunc.Invoke()"); } }
/// <summary> /// Quantized Mesh Response. /// </summary> public QuantizedMeshResponse Invoke(QuantizedMeshRequestArgument arg) { _log.LogInformation("In QuantizedMeshRequestComputeFunc.Invoke()"); try { // Quantized mesh requests can be a significant resource commitment. Ensure TPaaS will be listening... PerformTPaaSRequestLivelinessCheck(arg); // Supply the TRex ID of the Ignite node currently running this code to permit processing contexts to send // subgrid results to it. arg.TRexNodeID = TRexNodeID.ThisNodeID(StorageMutability.Immutable); _log.LogDebug($"Assigned TRexNodeId from local node is {arg.TRexNodeID}"); var request = new QMTileExecutor(arg.ProjectID, arg.Filters, arg.X, arg.Y, arg.Z, arg.DisplayMode, arg.HasLighting, arg.TRexNodeID); _log.LogInformation("Executing request.Execute()"); if (!request.ExecuteAsync().WaitAndUnwrapException()) { _log.LogError("Request execution failed"); } return(request.QMTileResponse); } catch (Exception e) { _log.LogError(e, "Exception requesting quantized mesh"); return(new QuantizedMeshResponse { ResultStatus = Types.RequestErrorStatus.Exception }); } finally { _log.LogDebug("Exiting QuantizedMeshRequestComputeFunc.Invoke()"); } }
public CSVExportRequestResponse Invoke(CSVExportRequestArgument arg) { _log.LogInformation($"In {nameof(Invoke)}"); try { // Export requests can be a significant resource commitment. Ensure TPaaS will be listening... PerformTPaaSRequestLivelinessCheck(arg); // Supply the TRex ID of the Ignite node currently running this code to permit processing contexts to send // sub grid results to it. arg.TRexNodeID = TRexNodeID.ThisNodeID(StorageMutability.Immutable); _log.LogInformation($"Assigned TRexNodeId from local node is {arg.TRexNodeID}"); var request = new CSVExportComputeFuncExecutor(arg); _log.LogInformation("Executing request.ExecuteAsync()"); if (!request.ExecuteAsync().WaitAndUnwrapException()) { _log.LogError("Request execution failed"); } return(request.CSVExportRequestResponse); } catch (Exception e) { _log.LogError(e, "Exception exporting CSV file"); return(new CSVExportRequestResponse { ResultStatus = Types.RequestErrorStatus.Exception }); } finally { _log.LogInformation($"Out {nameof(Invoke)}"); } }
public TileRenderResponse Invoke(TileRenderRequestArgument arg) { try { // Tile requests can be a significant resource commitment. Ensure TPaaS will be listening... PerformTPaaSRequestLivelinessCheck(arg); var requestStopWatch = Stopwatch.StartNew(); _log.LogInformation("In TileRenderRequestComputeFunc.Invoke()"); try { // Supply the TRex ID of the Ignite node currently running this code to permit processing contexts to send // sub grid results to it. arg.TRexNodeID = TRexNodeID.ThisNodeID(StorageMutability.Immutable); _log.LogInformation($"Assigned TRexNodeId from local node is {arg.TRexNodeID}"); var render = new RenderOverlayTile (arg.ProjectID, arg.Mode, new XYZ(arg.Extents.MinX, arg.Extents.MinY), new XYZ(arg.Extents.MaxX, arg.Extents.MaxY), arg.CoordsAreGrid, arg.PixelsX, arg.PixelsY, arg.Filters, arg.ReferenceDesign, arg.Palette, Color.Black, arg.TRexNodeID, arg.LiftParams, arg.VolumeType); _log.LogInformation("Executing render.ExecuteAsync()"); using var bmp = render.ExecuteAsync().WaitAndUnwrapException(); _log.LogInformation($"Render status = {render.ResultStatus}"); if (bmp == null) { _log.LogInformation("Null bitmap returned by executor"); return(new TileRenderResponse { TileBitmapData = null, ResultStatus = render.ResultStatus }); } using var image = SKImage.FromBitmap(bmp); using var data = image.Encode(SKEncodedImageFormat.Png, 100); using var stream = RecyclableMemoryStreamManagerHelper.Manager.GetStream(); data.SaveTo(stream); return(new TileRenderResponse { TileBitmapData = stream.ToArray(), ResultStatus = render.ResultStatus }); } finally { _log.LogInformation($"Exiting TileRenderRequestComputeFunc.Invoke() in {requestStopWatch.Elapsed}"); // Flag tile renders that take more than 20 seconds to render... if (requestStopWatch.Elapsed > _tileRequestTimeSpanWarnLimit) { _log.LogInformation($"Tile render request required more than {_tileRequestTimeSpanWarnLimit} to complete"); } } } catch (Exception e) { _log.LogError(e, "Exception occurred in TileRenderRequestComputeFunc.Invoke()"); return(new TileRenderResponse { ResultStatus = Types.RequestErrorStatus.Exception }); } }