static public int SparkJobSubmit()
        {
            SubmitGeneralJobParams jobParams = new SubmitGeneralJobParams()
            {
                Spark = new SparkGeneral()
                {
                    MainFile  = "com.anasystem.spark.AssociationrulesTrain",
                    Workers   = new string[] { "10.57.234.249", "10.57.234.250", "10.57.234.251" },
                    Driver    = "10.57.234.251",
                    Priority  = "normal",
                    Arguments = "sCTphzCqB5wDxFSO6d1ELX9Md2X5fi+jC1sKtKt9cxpvmUAv1y0UCav5xYQdvaq1p/ZYE09NYaF8rBXIp3PxbXiirIeSzJZf05bNgde/sfWThv72d9Ena8cp7o3pgOQuUugWay/VkyV+AwA9XJsIThydzXBTldQE96svz7HolOFPmdNOWtKv/VVVUcUpmTmj7TAto1oQr42g7+dzV0Z8S+hTkdK07KZc1bnZRfZLjsx0RkGgnx2SEZ+Rs+SMadTR98MdKvdqs+dDN4IgRRk9vQ=="
                },
                S3 = new S3GerneralJob()
                {
                    InputPath = "AlgorithmsPool/spark-training-phase.jar",
                    AccessKey = "6MWMHIE0NMV060E59S3I",
                    SecretKey = "c95vzcMgLq33Bx2KfBWZZhyZkWYpwlgnMC3kWsy2",
                }
            };

            int jobId = 0;

            if (_userApiClient.SparkJobGeneralSubmit(jobParams, out jobId) == System.Net.HttpStatusCode.OK)
            {
                Console.WriteLine($"工作上傳成功,取得工作Id {jobId}");
            }
            return(jobId);
        }
Beispiel #2
0
        public HttpStatusCode SparkJobGeneralSubmit(SubmitGeneralJobParams submitJobParams, out int jobId)
        {
            jobId = 0;
            string         responseString = null;
            string         jsonString     = JsonConvert.SerializeObject(submitJobParams);
            HttpStatusCode resultCode     = HttpPost($"Spark/Job/General/Submit", jsonString, out responseString);

            if (resultCode == HttpStatusCode.OK)
            {
                JObject jobject = JObject.Parse(responseString);
                jobId = jobject["JobId"].ToObject <int>();
            }
            return(resultCode);
        }