public static async Task <HttpResponseMessage> SubmiteWaterMarkJob([HttpTrigger(AuthorizationLevel.Function, "post", Route = null)] HttpRequestMessage req, TraceWriter log, ExecutionContext context) { IActionsProvider myActions = ActionProviderFactory.GetActionProvider(); dynamic BodyData = await req.Content.ReadAsAsync <object>(); ManifestInfo manifest = BodyData.ToObject <ManifestInfo>(); int K8SJobAggregation = int.Parse(System.Configuration.ConfigurationManager.AppSettings["K8SJobAggregation"]); int K8SJobAggregationOnlyEmb = int.Parse(System.Configuration.ConfigurationManager.AppSettings["K8SJobAggregationOnlyEmb"] ?? "1"); try { //Get JOBList to Send to K8S cluster List <ManifestInfo> jobList = myActions.GetK8SManifestInfo(K8SJobAggregation, K8SJobAggregationOnlyEmb, manifest); //Sumbite to K8S cluster int jobSubId = 1; foreach (var job in jobList) { var ret = await myActions.SubmiteJobK8S(job, jobSubId); log.Info($"{job.VideoInformation.FirstOrDefault().FileName} CODE {ret.Code.ToString()}"); jobSubId += 1; if (!ret.IsSuccessStatusCode) { log.Error($"K8S Summition Error {ret.Code.ToString()} {ret.Content}"); throw new Exception($"K8S Summition Error {ret.Code.ToString()} {ret.Content}"); } } return(req.CreateResponse(HttpStatusCode.OK, jobList, JsonMediaTypeFormatter.DefaultMediaType)); } catch (Exception X) { return(req.CreateResponse(HttpStatusCode.InternalServerError, X, JsonMediaTypeFormatter.DefaultMediaType)); } }