public async Task <K8SResult> SubmiteJobK8S(ManifestInfo manifest, int subId)
        {
            //Create Yamal Job definition
            string      manifesttxt = Newtonsoft.Json.JsonConvert.SerializeObject(manifest);
            string      jobbase64   = System.Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(manifesttxt), Base64FormattingOptions.None);
            string      imageName   = System.Configuration.ConfigurationManager.AppSettings["imageName"];
            string      jobtxt      = GetJobYmal(manifest.JobID + "-" + subId.ToString(), jobbase64, imageName);
            HttpContent ymal        = new StringContent(jobtxt, Encoding.UTF8, "application/yaml");

            // Submite JOB
            IK8SClient k8sClient = K8SClientFactory.Create();
            var        rs        = await k8sClient.SubmiteK8SJob(ymal);

            return(rs);
        }
Exemple #2
0
        public async Task <K8SResult> SubmiteJobK8S(ManifestInfo manifest, int subId)
        {
            //Create Yamal Job definition
            manifest.JobID = $"{manifest.JobID}-{subId}";
            string manifesttxt = Newtonsoft.Json.JsonConvert.SerializeObject(manifest);
            //Save JOB data on Blob Storage And Generate a SASURL
            string      jobbase64         = SaveBlobData(manifesttxt, $"{manifest.JobID}.json");
            string      imageName         = System.Configuration.ConfigurationManager.AppSettings["imageName"];
            string      PARALLELEMBEDDERS = System.Configuration.ConfigurationManager.AppSettings["PARALLELEMBEDDERS"] ?? "5";
            string      jobtxt            = GetJobYmal(manifest.JobID, jobbase64, imageName, PARALLELEMBEDDERS);
            HttpContent ymal = new StringContent(jobtxt, Encoding.UTF8, "application/yaml");

            SaveBlobData(jobtxt, $"{manifest.JobID}.ymal");
            // Submite JOB
            IK8SClient k8sClient = K8SClientFactory.Create();
            var        rs        = await k8sClient.SubmiteK8SJob(ymal);

            if (!rs.IsSuccessStatusCode)
            {
                Trace.TraceError($"[{manifest.JobID}]SubmiteJobK8S : {jobtxt}");
            }
            return(rs);
        }