Projekt

Obecné

Profil

« Předchozí | Další » 

Revize bf95cbdd

Přidáno uživatelem Eliška Mourycová před téměř 4 roky(ů)

Added model commands handling - not tested.

Zobrazit rozdíly:

Server/ServerApp/DataDownload/DataDownloader.cs
91 91
		/// <summary>
92 92
		/// Downloads json file - returns contents of said file
93 93
		/// </summary>
94
		/// <returns> Path to file </returns>
94
		/// <returns> String containing the weather prediction </returns>
95 95
		public string DownloadWeatherPrediction()
96 96
		{
97 97
			// TODO either set this path as attribute or if parameter JsonParser needs an attribute that would be set through constructor
Server/ServerApp/User/CommandsAcceptor.cs
159 159
			// model -files
160 160
			// model -retrain
161 161
			// model -rollback
162

  
163
			// todo if the command has something else after the flag - abort?
164
			if (c.FlagsAndData.ContainsKey("files"))
165
			{
166
				List<string> files = (List<string>)model.GetDataFileNames();
167
				Console.WriteLine("Listing current model's trianing data...");
168

  
169
				foreach (string f in files)
170
					Console.WriteLine(f);
171
			}
172
			else if (c.FlagsAndData.ContainsKey("retrain"))
173
			{
174

  
175
			}
176
			else if (c.FlagsAndData.ContainsKey("rollback"))
177
			{
178
				Console.WriteLine("Switching back to the previous version of the predictor...");
179
				int s = model.Rollback();
180
				switch (s)
181
				{
182
					case 0:
183
						Console.WriteLine("Rollback succesful.");
184
						break;
185
					case 1:
186
						Console.WriteLine("No previous version of the predictor exists!");
187
						break;
188
					case 2:
189
						Console.WriteLine("Error occured while trying to perform rollback - corrupted or removed Predictor.config file!"); // todo?
190
						break;
191
					default:
192
						Console.WriteLine("Unknown error occured when performing rollback.");
193
						break;
194
				}
195
			}
196

  
197

  
198
			//model.Rollback() // 0 -ok, 1 nejde, 2 - error (kdyz nekdo smaze soubor config)
199
			//model.GetDataFileNames();
162 200
		}
163 201

  
164 202
		private void HandleHelpCommand(Command c)

Také k dispozici: Unified diff