- Timestamp:
- 05/03/11 15:45:04 (13 years ago)
- Location:
- branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/Core.cs
r6101 r6107 177 177 // handle exception of task 178 178 clientCom.LogMessage(t.Exception.ToString()); 179 wcfService.UpdateJobState(container.JobId, JobState.Failed, t.Exception.ToString()); 180 SlaveStatusInfo.JobsAborted++; 179 181 }, TaskContinuationOptions.OnlyOnFaulted); 180 182 break; … … 474 476 catch (Exception exception) { 475 477 clientCom.LogMessage(string.Format("Copying plugins for job {0} failed: {1}", myJob.Id, exception)); 478 wcfService.UpdateJobState(myJob.Id, JobState.Failed, exception.ToString()); 479 SlaveStatusInfo.JobsAborted++; 480 476 481 lock (engines) { 477 482 if (jobs.ContainsKey(myJob.Id)) { … … 501 506 clientCom.LogMessage("Creating the Appdomain and loading the job failed for job " + myJob.Id); 502 507 clientCom.LogMessage("Error thrown is: " + exception.ToString()); 508 509 if (engines.ContainsKey(myJob.Id) && engines[myJob.Id].CurrentException != string.Empty) { 510 wcfService.UpdateJobState(myJob.Id, JobState.Failed, engines[myJob.Id].CurrentException); 511 } else { 512 wcfService.UpdateJobState(myJob.Id, JobState.Failed, exception.ToString()); 513 } 514 SlaveStatusInfo.JobsAborted++; 515 503 516 KillAppDomain(myJob.Id); 504 517 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/PluginCache.cs
r6101 r6107 60 60 } 61 61 62 /// <summary> 63 /// Returns the last directory of a path 64 /// </summary> 62 65 private string GetFilenameFromPath(string path) { 63 66 string[] dirParts = path.Split(Path.DirectorySeparatorChar); … … 72 75 SafelyCreateDirectory(PluginCacheDir); 73 76 foreach (string dir in Directory.EnumerateDirectories(PluginCacheDir)) { 74 cachedPluginsGuids.Add(Guid.Parse(GetFilenameFromPath(dir))); // Todo: cleaner solution to getFilenameFromPath77 cachedPluginsGuids.Add(Guid.Parse(GetFilenameFromPath(dir))); 75 78 } 76 79 } … … 137 140 } 138 141 139 [MethodImpl(MethodImplOptions.Synchronized)] 142 /// <summary> 143 /// Updates the plugin cache with missing plugins and 144 /// then copies the required plugins for the job. 145 /// </summary> 140 146 internal void PreparePlugins(Job myJob, out string configFileName) { 141 147 lock (locker) { 142 SlaveClientCom.Instance.ClientCom.LogMessage("Fetching plugins for job"); 143 144 List<Plugin> requiredPlugins = new List<Plugin>(); 148 SlaveClientCom.Instance.ClientCom.LogMessage("Fetching plugins for job " + myJob.Id); 149 150 List<Guid> missingGuids = new List<Guid>(); 151 List<Plugin> neededPlugins = new List<Plugin>(); 145 152 foreach (Guid pluginId in myJob.PluginsNeededIds) { 146 //TODO: rewrite, GetPlugin(..) should be the last thing to do after checking the local plugins147 153 Plugin plugin = WcfService.Instance.GetPlugin(pluginId); 148 if (plugin != null) 149 requiredPlugins.Add(plugin); 150 } 151 152 List<Plugin> localPlugins = new List<Plugin>(); 153 List<Plugin> missingPlugins = new List<Plugin>(); 154 List<Guid> missingGuids = new List<Guid>(); 155 bool found = false; 156 157 foreach (Plugin info in requiredPlugins) { 158 foreach (Guid cachedPlugin in cachedPluginsGuids) { 159 if (info.Id == cachedPlugin) { 160 localPlugins.Add(new Plugin() { Id = cachedPlugin, Name = info.Name, Version = info.Version }); 161 found = true; 162 163 break; 164 } 165 } 166 if (!found) { 167 SlaveClientCom.Instance.ClientCom.LogMessage("Plugin NOT found " + info.Name + ", " + info.Version); 168 missingPlugins.Add(info); 169 missingGuids.Add(info.Id); 170 } 171 found = false; 172 } 173 174 SlaveClientCom.Instance.ClientCom.LogMessage("First run - Update the plugins in the cache"); 175 localPlugins.AddRange(missingPlugins); 154 if (plugin != null) { 155 neededPlugins.Add(plugin); 156 } 157 158 if (!cachedPluginsGuids.Contains(pluginId)) { 159 missingGuids.Add(pluginId); 160 } 161 } 176 162 177 163 IEnumerable<PluginData> pluginDatas = WcfService.Instance.GetPluginDatas(missingGuids); … … 187 173 188 174 DoUpdateRun(); 189 CopyPluginsForJob( requiredPlugins, myJob.Id, out configFileName);175 CopyPluginsForJob(neededPlugins, myJob.Id, out configFileName); 190 176 } else { 191 177 configFileName = ""; 192 178 } 179 180 SlaveClientCom.Instance.ClientCom.LogMessage("Fetched " + missingGuids.Count + " plugins for job " + myJob.Id); 193 181 } 194 182 }
Note: See TracChangeset
for help on using the changeset viewer.