- Timestamp:
- 02/14/11 18:23:37 (14 years ago)
- Location:
- branches/HeuristicLab.Hive-3.4/sources
- Files:
-
- 2 added
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave.ConsoleClient-3.4/HeuristicLab.Clients.Hive.Slave.ConsoleClient-3.4.csproj
r5375 r5458 82 82 </None> 83 83 </ItemGroup> 84 <ItemGroup> 85 <Content Include="ICSharpCode.SharpZipLib License.txt"> 86 <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> 87 </Content> 88 </ItemGroup> 84 89 <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> 85 90 <!-- To modify your build process, add your task inside one of the targets below and uncomment it. -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave.Tests/Mocks/MockHiveService.cs
r5405 r5458 231 231 } 232 232 233 public Guid GetResourceId(string resourceName) { 234 // todo 235 return Guid.Empty; 236 } 237 233 238 #endregion 234 239 … … 324 329 } 325 330 #endregion 331 326 332 } 327 333 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/Core.cs
r5451 r5458 402 402 String pluginDir = Path.Combine(PluginCache.Instance.PluginTempBaseDir, myJob.Id.ToString()); 403 403 bool pluginsPrepared = false; 404 string configFileName = string.Empty; 404 405 405 406 try { 406 PluginCache.Instance.PreparePlugins(myJob, jobData);407 PluginCache.Instance.PreparePlugins(myJob, out configFileName); 407 408 ClientCom.LogMessage("Plugins fetched for job " + myJob.Id); 408 409 pluginsPrepared = true; … … 414 415 if (pluginsPrepared) { 415 416 try { 416 AppDomain appDomain = HeuristicLab.PluginInfrastructure.Sandboxing.SandboxManager.CreateAndInitSandbox(myJob.Id.ToString(), pluginDir, Path.Combine(pluginDir, PluginCache.ConfigFileName));417 AppDomain appDomain = HeuristicLab.PluginInfrastructure.Sandboxing.SandboxManager.CreateAndInitSandbox(myJob.Id.ToString(), pluginDir, Path.Combine(pluginDir, configFileName)); 417 418 appDomain.UnhandledException += new UnhandledExceptionEventHandler(appDomain_UnhandledException); 418 419 lock (engines) { -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/PluginCache.cs
r5451 r5458 34 34 public class PluginCache { 35 35 private static object locker = new object(); 36 public const string ConfigFileName = "Sandbox.config";37 36 private const string lastUsedFileName = "lastUsed.dat"; 38 37 … … 52 51 instance = new PluginCache(); 53 52 return instance; 54 }55 }56 57 public string ConfigFilePath {58 get {59 return Path.Combine(PluginCacheDir, ConfigFileName);60 53 } 61 54 } … … 83 76 84 77 foreach (string dir in Directory.EnumerateDirectories(PluginCacheDir)) { 85 cachedPluginsGuids.Add(Guid.Parse(getFilenameFromPath(dir))); 78 cachedPluginsGuids.Add(Guid.Parse(getFilenameFromPath(dir))); // Todo: cleaner solution to getFilenameFromPath 86 79 } 87 80 } 88 81 89 82 [MethodImpl(MethodImplOptions.Synchronized)] 90 public void CopyPluginsForJob(List<Plugin> requests, Guid jobId ) {83 public void CopyPluginsForJob(List<Plugin> requests, Guid jobId, out string configFileName) { 91 84 lock (locker) { 85 configFileName = string.Empty; 92 86 String targetDir = Path.Combine(PluginTempBaseDir, jobId.ToString()); 93 87 … … 97 91 Directory.CreateDirectory(targetDir); 98 92 99 100 93 foreach (Plugin requestedPlugin in requests) { 101 string curPath = Path.Combine(PluginCacheDir, requestedPlugin.Id.ToString()); 102 if (Directory.Exists(curPath)) { 103 writeDateLastUsed(curPath); 104 105 foreach (string file in Directory.GetFiles(curPath)) { 106 string fn = getFilenameFromPath(file); 107 if (fn != lastUsedFileName) 108 File.Copy(file, Path.Combine(targetDir, fn)); 109 } 110 } 111 } 112 113 // copy config file 114 File.Copy(ConfigFilePath, Path.Combine(targetDir, ConfigFileName)); 115 116 // copy files from PluginInfrastructure, which are not declared 94 var filePaths = GetPluginFilePaths(requestedPlugin.Id); 95 foreach (string filePath in filePaths) { 96 File.Copy(filePath, Path.Combine(targetDir, Path.GetFileName(filePath))); 97 } 98 99 if (requestedPlugin.Name == "Configuration") { 100 configFileName = Path.Combine(targetDir, Path.GetFileName(filePaths.SingleOrDefault())); // configuration plugin consists only of 1 file (usually the "HeuristicLab X.X.exe.config") 101 } 102 } 103 104 // copy files from PluginInfrastructure (which are not declared in any plugins) 117 105 string baseDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); 118 106 CopyFile(baseDir, targetDir, "HeuristicLab.PluginInfrastructure-3.3.dll"); … … 137 125 138 126 [MethodImpl(MethodImplOptions.Synchronized)] 139 internal void PreparePlugins(Job myJob, JobData jobData) {127 internal void PreparePlugins(Job myJob, out string configFileName) { 140 128 lock (locker) { 141 129 SlaveClientCom.Instance.ClientCom.LogMessage("Fetching plugins for job"); … … 174 162 localPlugins.AddRange(missingPlugins); 175 163 176 IEnumerable<PluginData> updateablePlugins = WcfService.Instance.GetPluginDatas(missingGuids);177 178 foreach (PluginData updateablePlugin in updateablePlugins) {179 string pluginDir = Path.Combine(PluginCacheDir, updateablePlugin.PluginId.ToString());164 IEnumerable<PluginData> pluginDatas = WcfService.Instance.GetPluginDatas(missingGuids); 165 166 foreach (PluginData pluginData in pluginDatas) { 167 string pluginDir = Path.Combine(PluginCacheDir, pluginData.PluginId.ToString()); 180 168 181 169 //put all files belonging to a plugin in the same directory … … 183 171 DirectoryInfo di = Directory.CreateDirectory(pluginDir); 184 172 } 185 File.WriteAllBytes(Path.Combine(pluginDir, Path.GetFileName(updateablePlugin.FileName)), updateablePlugin.Data); 186 } 187 188 PluginData configFile = WcfService.Instance.GetConfigurationFile(); 189 File.WriteAllBytes(ConfigFilePath, configFile.Data); 173 File.WriteAllBytes(Path.Combine(pluginDir, Path.GetFileName(pluginData.FileName)), pluginData.Data); 174 } 190 175 191 176 DoUpdateRun(); 192 CopyPluginsForJob(requiredPlugins, myJob.Id); 177 CopyPluginsForJob(requiredPlugins, myJob.Id, out configFileName); 178 } 179 } 180 181 /// <summary> 182 /// Returns a list of files which belong to a plugin from the plugincache 183 /// </summary> 184 private IEnumerable<string> GetPluginFilePaths(Guid pluginId) { 185 string pluginPath = Path.Combine(PluginCacheDir, pluginId.ToString()); 186 187 if (Directory.Exists(pluginPath)) { 188 WriteDateLastUsed(pluginPath); 189 foreach (string filePath in Directory.GetFiles(pluginPath)) { 190 string fn = Path.GetFileName(filePath); 191 if (fn != lastUsedFileName) 192 yield return filePath; 193 } 193 194 } 194 195 } … … 198 199 /// this can later be used to find plugins which are outdated 199 200 /// </summary> 200 private void writeDateLastUsed(string path) {201 private void WriteDateLastUsed(string path) { 201 202 FileStream fs = new FileStream(Path.Combine(path, lastUsedFileName), FileMode.Create); 202 203 BinaryFormatter formatter = new BinaryFormatter(); … … 218 219 /// </summary> 219 220 /// <param name="path"></param> 220 private void cleanPluginCache() {221 private void CleanPluginCache() { 221 222 FileStream fs = null; 222 223 DateTime luDate; … … 274 275 SlaveClientCom.Instance.ClientCom.LogMessage("failed while unloading " + id + " with exception " + ex); 275 276 } 276 cleanPluginCache();277 CleanPluginCache(); 277 278 } 278 279 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/WcfService.cs
r5405 r5458 238 238 } 239 239 240 public PluginData GetConfigurationFile() {241 using (Disposable<IHiveService> service = GetSlaveService()) {242 try {243 PluginData msg = service.Obj.GetConfigurationFile();244 return msg;245 }246 catch (Exception ex) {247 HandleNetworkError(ex);248 return null;249 }250 }251 }252 253 240 private static Disposable<IHiveService> GetSlaveService() { 254 241 return ServiceLocator.Instance.GetService("hiveslave", "hiveslave"); -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Views/3.4/ExperimentManager/HiveExperimentView.Designer.cs
r5402 r5458 63 63 this.pauseButton = new System.Windows.Forms.Button(); 64 64 this.resourceIdsLabel = new System.Windows.Forms.Label(); 65 this.resource IdsTextBox = new System.Windows.Forms.TextBox();65 this.resourceNamesTextBox = new System.Windows.Forms.TextBox(); 66 66 this.disconnectButton = new System.Windows.Forms.Button(); 67 67 this.reconnectButton = new System.Windows.Forms.Button(); … … 289 289 // resourceIdsTextBox 290 290 // 291 this.resource IdsTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)292 | System.Windows.Forms.AnchorStyles.Right))); 293 this.resource IdsTextBox.Location = new System.Drawing.Point(72, 52);294 this.resource IdsTextBox.Name = "resourceIdsTextBox";295 this.resource IdsTextBox.Size = new System.Drawing.Size(559, 20);296 this.resource IdsTextBox.TabIndex = 14;297 this.resource IdsTextBox.Validated += new System.EventHandler(this.resourceIdsTextBox_Validated);291 this.resourceNamesTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 292 | System.Windows.Forms.AnchorStyles.Right))); 293 this.resourceNamesTextBox.Location = new System.Drawing.Point(72, 52); 294 this.resourceNamesTextBox.Name = "resourceIdsTextBox"; 295 this.resourceNamesTextBox.Size = new System.Drawing.Size(559, 20); 296 this.resourceNamesTextBox.TabIndex = 14; 297 this.resourceNamesTextBox.Validated += new System.EventHandler(this.resourceNamesTextBox_Validated); 298 298 // 299 299 // disconnectButton … … 364 364 this.Controls.Add(this.disconnectButton); 365 365 this.Controls.Add(this.startButton); 366 this.Controls.Add(this.resource IdsTextBox);366 this.Controls.Add(this.resourceNamesTextBox); 367 367 this.Controls.Add(this.executionTimeTextBox); 368 368 this.Controls.Add(this.resourceIdsLabel); … … 385 385 this.Controls.SetChildIndex(this.resourceIdsLabel, 0); 386 386 this.Controls.SetChildIndex(this.executionTimeTextBox, 0); 387 this.Controls.SetChildIndex(this.resource IdsTextBox, 0);387 this.Controls.SetChildIndex(this.resourceNamesTextBox, 0); 388 388 this.Controls.SetChildIndex(this.startButton, 0); 389 389 this.Controls.SetChildIndex(this.disconnectButton, 0); … … 413 413 private System.Windows.Forms.Button pauseButton; 414 414 private System.Windows.Forms.Label resourceIdsLabel; 415 private System.Windows.Forms.TextBox resource IdsTextBox;415 private System.Windows.Forms.TextBox resourceNamesTextBox; 416 416 private System.Windows.Forms.Button viewExperimentButton; 417 417 private Core.Views.NamedItemView experimentNamedItemView; -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Views/3.4/ExperimentManager/HiveExperimentView.cs
r5402 r5458 83 83 if (Content == null) { 84 84 executionTimeTextBox.Text = string.Empty; 85 resource IdsTextBox.Text = string.Empty;85 resourceNamesTextBox.Text = string.Empty; 86 86 useLocalPluginsCheckBox.Checked = false; 87 87 logView.Content = null; 88 88 } else { 89 89 executionTimeTextBox.Text = Content.ExecutionTime.ToString(); 90 resource IdsTextBox.Text = Content.ResourceIds;90 resourceNamesTextBox.Text = Content.ResourceNames; 91 91 useLocalPluginsCheckBox.Checked = Content.UseLocalPlugins; 92 92 logView.Content = Content.Log; … … 104 104 this.nameTextBox.ReadOnly = Content.ExecutionState != ExecutionState.Prepared; 105 105 this.descriptionTextBox.ReadOnly = Content.ExecutionState != ExecutionState.Prepared; 106 this.resource IdsTextBox.ReadOnly = Content.ExecutionState != ExecutionState.Prepared;106 this.resourceNamesTextBox.ReadOnly = Content.ExecutionState != ExecutionState.Prepared; 107 107 this.hiveJobView.ReadOnly = Content.ExecutionState != ExecutionState.Prepared; 108 108 this.useLocalPluginsCheckBox.Enabled = Content.ExecutionState == ExecutionState.Prepared; … … 214 214 } 215 215 216 private void resource IdsTextBox_Validated(object sender, EventArgs e) {217 Content.Resource Ids = resourceIdsTextBox.Text;216 private void resourceNamesTextBox_Validated(object sender, EventArgs e) { 217 Content.ResourceNames = resourceNamesTextBox.Text; 218 218 } 219 219 -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ExperimentManager/HiveExperimentClient.cs
r5404 r5458 38 38 using HeuristicLab.PluginInfrastructure; 39 39 using System.IO; 40 using System.Configuration; 41 using System.Reflection; 42 using HeuristicLab.PluginInfrastructure.Manager; 40 43 41 44 /// <summary> … … 76 79 } 77 80 78 private string resource Ids;79 public string Resource Ids {80 get { return resource Ids; }81 private string resourceNames; 82 public string ResourceNames { 83 get { return resourceNames; } 81 84 set { 82 if (resource Ids != value) {83 resource Ids = value;84 OnResource IdsChanged();85 if (resourceNames != value) { 86 resourceNames = value; 87 OnResourceNamesChanged(); 85 88 } 86 89 } … … 117 120 public IEnumerable<Plugin> OnlinePlugins { 118 121 get { return onlinePlugins; } 119 set { onlinePlugins = value; } 122 set { onlinePlugins = value; } 120 123 } 121 124 … … 131 134 set { useLocalPlugins = value; } 132 135 } 133 134 public HiveExperimentClient() : base(itemName, itemDescription) {135 // TODO //this.ResourceIds = HeuristicLab.Hive.Experiment.Properties.Settings.Default.ResourceIds;136 this.Resource Ids = "HEAL";136 137 public HiveExperimentClient() 138 : base(itemName, itemDescription) { 139 this.ResourceNames = "HEAL"; 137 140 this.log = new Log(); 138 141 InitTimer(); 139 142 } 140 public HiveExperimentClient(DT.HiveExperiment hiveExperimentDto) : this() { 143 public HiveExperimentClient(DT.HiveExperiment hiveExperimentDto) 144 : this() { 141 145 UpdateFromDto(hiveExperimentDto); 142 146 } 143 147 protected HiveExperimentClient(HiveExperimentClient original, Cloner cloner) 144 148 : base(original, cloner) { 145 this.Resource Ids = original.resourceIds;149 this.ResourceNames = original.resourceNames; 146 150 this.ExecutionState = original.executionState; 147 151 this.ExecutionTime = original.executionTime; … … 158 162 this.Name = hiveExperimentDto.Name; 159 163 this.Description = hiveExperimentDto.Description; 160 // TODO: this.ResourceIds = hiveExperimentDto.ResourceIds;164 this.ResourceNames = hiveExperimentDto.ResourceNames; 161 165 this.rootJobId = hiveExperimentDto.RootJobId; 162 166 } … … 167 171 Name = this.Name, 168 172 Description = this.Description, 169 //ResourceIds = this.ResourceIds,173 ResourceNames = this.ResourceNames, 170 174 RootJobId = this.rootJobId 171 175 }; … … 227 231 228 232 public void Prepare() { 229 // do nothing 233 this.timer.Stop(); 234 this.ExecutionState = Core.ExecutionState.Prepared; 235 this.ExecutionTime = TimeSpan.Zero; 230 236 } 231 237 232 238 public void Start() { 233 239 OnStarted(); 234 ExecutionTime = new TimeSpan();240 ExecutionTime = TimeSpan.Zero; 235 241 lastUpdateTime = DateTime.Now; 236 242 this.ExecutionState = Core.ExecutionState.Started; … … 246 252 IsProgressing = true; 247 253 using (Disposable<IHiveService> service = ServiceLocator.Instance.GetService()) { 248 IEnumerable<string> groups = ToResourceIdList(this.ResourceIds); 254 IEnumerable<string> resourceNames = ToResourceNameList(this.ResourceNames); 255 var resourceIds = new List<Guid>(); 256 foreach (var resourceName in resourceNames) { 257 Guid resourceId = service.Obj.GetResourceId(resourceName); 258 if (resourceId == Guid.Empty) { 259 throw new ResourceNotFoundException(string.Format("Could not find the resource '{0}'", resourceName)); 260 } 261 resourceIds.Add(resourceId); 262 } 263 249 264 this.HiveJob.SetIndexInParentOptimizerList(null); 250 265 … … 255 270 this.OnlinePlugins = service.Obj.GetPlugins(); 256 271 this.AlreadyUploadedPlugins = new List<Plugin>(); 272 Plugin configFilePlugin = UploadConfigurationFile(service.Obj); 273 this.alreadyUploadedPlugins.Add(configFilePlugin); 257 274 258 275 this.progress.Status = "Uploading jobs..."; 259 UploadJobWithChildren(service.Obj, this.HiveJob, null, groups, ref jobCount, totalJobCount);276 UploadJobWithChildren(service.Obj, this.HiveJob, null, resourceIds, ref jobCount, totalJobCount, configFilePlugin.Id); 260 277 this.rootJobId = this.HiveJob.Job.Id; 261 278 LogMessage("Finished sending jobs to hive"); … … 272 289 catch (Exception e) { 273 290 OnExceptionOccured(e); 291 this.Prepare(); 274 292 } 275 293 finally { 276 294 IsProgressing = false; 277 295 } 296 } 297 298 /// <summary> 299 /// Uploads the local configuration file as plugin 300 /// </summary> 301 private static Plugin UploadConfigurationFile(IHiveService service) { 302 string exeFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "HeuristicLab 3.3.exe"); 303 string configFileName = ConfigurationManager.OpenExeConfiguration(exeFilePath).FilePath; 304 305 Plugin configPlugin = new Plugin() { 306 Name = "Configuration", 307 IsLocal = true, 308 Version = new Version() 309 }; 310 PluginData configFile = new PluginData() { 311 FileName = configFileName, 312 Data = File.ReadAllBytes(configFileName) 313 }; 314 configPlugin.Id = service.AddPlugin(configPlugin, new List<PluginData> { configFile }); 315 return configPlugin; 278 316 } 279 317 … … 286 324 /// <param name="parentHiveJob">shall be null if its the root job</param> 287 325 /// <param name="groups"></param> 288 private void UploadJobWithChildren(IHiveService service, HiveJob hiveJob, HiveJob parentHiveJob, IEnumerable< string> groups, ref int jobCount, int totalJobCount) {326 private void UploadJobWithChildren(IHiveService service, HiveJob hiveJob, HiveJob parentHiveJob, IEnumerable<Guid> groups, ref int jobCount, int totalJobCount, Guid configPluginId) { 289 327 jobCount++; 290 328 this.progress.Status = string.Format("Serializing job {0} of {1}", jobCount, totalJobCount); … … 301 339 302 340 hiveJob.Job.PluginsNeededIds = GetPluginDependencies(service, onlinePlugins, alreadyUploadedPlugins, plugins, useLocalPlugins); 341 hiveJob.Job.PluginsNeededIds.Add(configPluginId); 303 342 304 343 this.progress.Status = string.Format("Uploading job {0} of {1} ({2} kb)", jobCount, totalJobCount, jobData.Data.Count() / 1024); … … 306 345 307 346 if (parentHiveJob != null) { 308 //response = service.AddChildJob(parentHiveJob.Job.Id, serializedJob);309 347 hiveJob.Job.Id = service.AddChildJob(parentHiveJob.Job.Id, hiveJob.Job, jobData); 310 348 } else { 311 // response = service.AddJobWithGroupStrings(serializedJob, groups); 312 hiveJob.Job.Id = service.AddJob(hiveJob.Job, jobData, null); // todo: use ResourceIds 349 hiveJob.Job.Id = service.AddJob(hiveJob.Job, jobData, groups); 313 350 } 314 351 … … 316 353 317 354 foreach (HiveJob child in hiveJob.ChildHiveJobs) { 318 UploadJobWithChildren(service, child, hiveJob, groups, ref jobCount, totalJobCount );319 } 320 } 321 355 UploadJobWithChildren(service, child, hiveJob, groups, ref jobCount, totalJobCount, configPluginId); 356 } 357 } 358 322 359 /// <summary> 323 360 /// Converts a string which can contain Ids separated by ';' to a enumerable 324 361 /// </summary> 325 private IEnumerable<string> ToResource IdList(string resourceGroups) {362 private IEnumerable<string> ToResourceNameList(string resourceGroups) { 326 363 if (!string.IsNullOrEmpty(resourceGroups)) { 327 return resource Ids.Split(';');364 return resourceNames.Split(';'); 328 365 } else { 329 366 return new List<string>(); … … 395 432 } 396 433 397 public event EventHandler Resource IdsChanged;398 protected virtual void OnResource IdsChanged() {399 EventHandler handler = Resource IdsChanged;434 public event EventHandler ResourceNamesChanged; 435 protected virtual void OnResourceNamesChanged() { 436 EventHandler handler = ResourceNamesChanged; 400 437 if (handler != null) handler(this, EventArgs.Empty); 401 438 } … … 649 686 } 650 687 } 651 #endregion 688 #endregion 652 689 653 690 #region Plugin Management -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/HeuristicLab.Clients.Hive-3.4.csproj
r5457 r5458 102 102 </Reference> 103 103 <Reference Include="System" /> 104 <Reference Include="System.Configuration" /> 104 105 <Reference Include="System.Core" /> 105 106 <Reference Include="System.Drawing" /> … … 118 119 <Compile Include="Exceptions\OptimizerNotFoundException.cs" /> 119 120 <Compile Include="ExperimentManager\PluginClient.cs" /> 121 <Compile Include="Exceptions\ResourceNotFoundException.cs" /> 120 122 <Compile Include="IServiceLocator.cs" /> 121 123 <Compile Include="Jobs\OptimizerJob.cs" /> -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/DataTransfer/HiveExperiment.cs
r5106 r5458 34 34 [DataMember] 35 35 public DateTime DateCreated { get; set; } 36 [DataMember] 37 public string ResourceNames { get; set; } 36 38 37 39 public HiveExperiment() { } … … 40 42 this.UserId = original.UserId; 41 43 this.DateCreated = original.DateCreated; 44 this.ResourceNames = original.ResourceNames; 42 45 } 43 46 public override IDeepCloneable Clone(Cloner cloner) { -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/ServiceContracts/IHiveService.cs
r5405 r5458 40 40 [OperationContract] 41 41 void DeleteChildJobs(Guid parentJobId); 42 43 [OperationContract]44 PluginData GetConfigurationFile();45 42 46 43 #endregion … … 133 130 void RemoveResourceFromGroup(Guid slaveGroupId, Guid resourceId); 134 131 132 [OperationContract] 133 Guid GetResourceId(string resourceName); 134 135 135 #endregion 136 136 -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/Convert.cs
r5405 r5458 94 94 public static DT.HiveExperiment ToDto(HiveExperiment source) { 95 95 if (source == null) return null; 96 return new DT.HiveExperiment { Id = source.HiveExperimentId, Description = source.Description, Name = source.Name, RootJobId = source.RootJobId, UserId = source.UserId, DateCreated = source.DateCreated };96 return new DT.HiveExperiment { Id = source.HiveExperimentId, Description = source.Description, Name = source.Name, RootJobId = source.RootJobId, UserId = source.UserId, DateCreated = source.DateCreated, ResourceNames = source.ResourceIds }; 97 97 } 98 98 public static HiveExperiment ToEntity(DT.HiveExperiment source) { … … 103 103 public static void ToEntity(DT.HiveExperiment source, HiveExperiment target) { 104 104 if ((source != null) && (target != null)) { 105 target.HiveExperimentId = source.Id; target.Description = source.Description; target.Name = source.Name; target.RootJobId = source.RootJobId; target.UserId = source.UserId; target.DateCreated = source.DateCreated; 105 target.HiveExperimentId = source.Id; target.Description = source.Description; target.Name = source.Name; target.RootJobId = source.RootJobId; target.UserId = source.UserId; target.DateCreated = source.DateCreated; target.ResourceIds = source.ResourceNames; 106 106 } 107 107 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/HiveService.cs
r5405 r5458 103 103 } 104 104 } 105 106 public PluginData GetConfigurationFile() {107 using (trans.OpenTransaction()) {108 //TODO: move filename to app.config109 PluginData configFile = dao.GetPluginDatas(x => x.FileName == "HeuristicLab 3.3.exe.config").SingleOrDefault();110 if (configFile == null) {111 //TODO: error handling112 return null;113 } else {114 return configFile;115 }116 }117 }118 105 119 106 #endregion … … 300 287 } 301 288 289 public Guid GetResourceId(string resourceName) { 290 using (trans.OpenTransaction()) { 291 var resource = dao.GetResources(x => x.Name == resourceName).FirstOrDefault(); 292 if (resource != null) { 293 return resource.Id; 294 } else { 295 return Guid.Empty; 296 } 297 } 298 } 302 299 #endregion 303 300 … … 322 319 #endregion 323 320 321 324 322 } 325 323 }
Note: See TracChangeset
for help on using the changeset viewer.