Пример #1
0
        public void fit_model(List <float> data)
        {
            var apiHostPorts        = _coordinator.getApiHostPorts();
            var currentModelVersion = _coordinator.getCurrentModelVersion();
            var newModelVersion     = _coordinator.incrementAndPublishNewModelVersion();

            try
            {
                var httpResponseMessage = doPostCall(apiHostPorts, FIT_MODEL_ENDPOINT,
                                                     new ApiModelFitRequest(newModelVersion.Version, data));
                if (!httpResponseMessage.IsSuccessStatusCode)
                {
                    Console.WriteLine("failed to install new model");
                    // We can rollback by simply publishing the "currentModelVersion" which refers to the old model version
                    // Which will make the api models reload to and old model
                    // It is not needed since it is not a requirement
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }