public async Task<ActionResult<string>> ExecutePrediction(PredictionParameters predictionParams) { try { if (predictionParams == null) return BadRequest(); string tmpConnString = Request.Headers["AzureStorageConnection"]; Predictions predict = new Predictions(tmpConnString); await predict.ExecutePrediction(predictionParams); } catch (Exception ex) { return BadRequest(ex.ToString()); } return Ok($"OK"); }
public static async Task <string> DataPrediction([ActivityTrigger] DataOpParameters pipe, ILogger log) { try { log.LogInformation($"Prediction: Starting prediction"); Predictions predictions = new Predictions(pipe.StorageAccount); PredictionParameters parms = JObject.Parse(pipe.JsonParameters).ToObject <PredictionParameters>(); log.LogInformation($"Prediction: Processing prediction id {parms.PredictionId}"); await predictions.ExecutePrediction(parms); log.LogInformation($"Prediction: Complete"); } catch (Exception ex) { log.LogInformation($"Prediction:Serious exception {ex}"); } return($"Prediction Rule {pipe.Id}"); }