Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/04/10 10:44:14 (14 years ago)
Author:
cneumuel
Message:

merged with changes from Hive-3.2

Location:
branches/3.3-HiveMigration/sources/HeuristicLab.Hive
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Client.Core/3.3/Core.cs

    r4119 r4141  
    4646using HeuristicLab.Tracing;
    4747using HeuristicLab.Core;
     48using System.IO;
    4849
    4950namespace HeuristicLab.Hive.Client.Core {
     
    134135
    135136        case MessageContainer.MessageType.JobAborted:
    136           //todo: thread this         
    137           lock (engines) {
    138             Guid jobId = new Guid(container.JobId.ToString());
    139             if (engines.ContainsKey(jobId)) {
    140               appDomains[jobId].UnhandledException -= new UnhandledExceptionEventHandler(appDomain_UnhandledException);
    141               AppDomain.Unload(appDomains[jobId]);
    142               appDomains.Remove(jobId);
    143               engines.Remove(jobId);
    144               jobs.Remove(jobId);
    145               GC.Collect();
    146             } else
    147               Logger.Error("JobAbort: Engine doesn't exist");
    148           }
     137          Guid jobId = new Guid(container.JobId.ToString());
     138          KillAppDomain(jobId);
    149139          break;
    150140
     
    247237        if (WcfService.Instance.ConnState == NetworkEnum.WcfConnState.Loggedin) {
    248238          Logger.Info("Sending the finished job with id: " + jId);
    249           wcfService.StoreFinishedJobResultAsync(ConfigManager.Instance.GetClientInfo().Id, jId, sJob, 1.0, null, true);
     239          wcfService.StoreFinishedJobResultAsync(ConfigManager.Instance.GetClientInfo().Id, jId, sJob, 1.0, engines[jId].CurrentException, true);
    250240        } else {
    251241          Logger.Info("Storing the finished job with id: " + jId + " to hdd");
    252242          JobStorageManager.PersistObjectToDisc(wcfService.ServerIP, wcfService.ServerPort, jId, sJob);
    253           lock (engines) {
    254             appDomains[jId].UnhandledException -= new UnhandledExceptionEventHandler(appDomain_UnhandledException);
    255 
    256             //Disposing it
    257             engines[jId].Dispose();
    258 
    259             AppDomain.Unload(appDomains[jId]);
    260             Logger.Debug("Unloaded appdomain");
    261             appDomains.Remove(jId);
    262             engines.Remove(jId);
    263             jobs.Remove(jId);
    264             Logger.Debug("Removed job from appDomains, Engines and Jobs");
    265           }
     243          KillAppDomain(jId);
    266244        }
    267245      } catch (InvalidStateException ise) {
     
    332310        PluginCache.Instance.PreparePlugins(e.Result.Job.PluginsNeeded);
    333311
     312        PluginCache.Instance.CopyPluginsForJob(e.Result.Job.PluginsNeeded, e.Result.Job.Id);
     313
    334314        //        foreach (CachedHivePluginInfoDto plugininfo in PluginCache.Instance.GetPlugins(e.Result.Job.PluginsNeeded))
    335315        //        files.AddRange(plugininfo.PluginFiles);
    336316        Logger.Debug("Plugins fetched for job " + e.Result.Job.Id);
    337317        try {
    338           AppDomain appDomain =
    339             HeuristicLab.PluginInfrastructure.Sandboxing.SandboxManager.CreateAndInitSandbox(
    340               e.Result.Job.Id.ToString(), null);
     318          String pluginDir = Path.Combine(PluginCache.PLUGIN_REPO, e.Result.Job.Id.ToString());
     319         
     320          AppDomain appDomain = HeuristicLab.PluginInfrastructure.Sandboxing.SandboxManager.CreateAndInitSandbox(pluginDir, null);
    341321          appDomain.UnhandledException += new UnhandledExceptionEventHandler(appDomain_UnhandledException);
    342322          lock (engines) {
     
    365345          CurrentlyFetching = false;
    366346          KillAppDomain(e.Result.Job.Id);
     347          wcfService.StoreFinishedJobResultsSync(ConfigManager.Instance.GetClientInfo().Id, e.Result.Job.Id, new byte[] { }, 1, exception, true);
    367348        }
    368349      } else
     
    497478          engines.Remove(id);
    498479          jobs.Remove(id);
     480          PluginCache.Instance.DeletePluginsForJob(id);
    499481          GC.Collect();
    500482        } catch (Exception ex) {
  • branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Client.Core/3.3/PluginCache.cs

    r4119 r4141  
    11using System;
    22using System.Collections.Generic;
     3using System.IO;
    34using System.Linq;
    4 using System.Text;
     5using System.Runtime.CompilerServices;
     6using HeuristicLab.Hive.Client.Communication;
     7using HeuristicLab.Hive.Contracts.BusinessObjects;
    58using HeuristicLab.PluginInfrastructure;
    6 using HeuristicLab.Hive.Client.Communication;
    7 using HeuristicLab.Hive.Client.Common;
    8 using HeuristicLab.Hive.Contracts.BusinessObjects;
     9using HeuristicLab.PluginInfrastructure.Manager;
    910using HeuristicLab.Tracing;
    10 using System.IO;
    1111
    1212namespace HeuristicLab.Hive.Client.Core {
     
    1414
    1515    private static PluginCache instance = null;
     16
     17    public const string PLUGIN_REPO = @"plugins\";
     18
     19    private List<PluginDescription> cachedPlugins = new List<PluginDescription>();
     20
     21    private PluginManager pm = new PluginManager(PLUGIN_REPO);
     22
    1623    public static PluginCache Instance {
    1724      get {
     
    2027        return instance;
    2128      }
    22     }
    23    
    24     private List<CachedHivePluginInfoDto> pluginCache;
    25    
    26 
     29    }
    2730    public PluginCache() {
    28       pluginCache = new List<CachedHivePluginInfoDto>();
    29     }
    30    
    31     public void AddPlugin(CachedHivePluginInfoDto plugin) {
    32       pluginCache.Add(plugin);   
     31      DoUpdateRun();
    3332    }
    3433
    35     public List<CachedHivePluginInfoDto> GetPlugins(List<HivePluginInfoDto> requests) {
     34    private void DoUpdateRun() {
     35      pm.DiscoverAndCheckPlugins();
     36      cachedPlugins = new List<PluginDescription>(pm.Plugins);
     37    }
     38
     39
     40    [MethodImpl(MethodImplOptions.Synchronized)]
     41    public bool CopyPluginsForJob(List<HivePluginInfoDto> requests, Guid jobId) {
     42
     43      String targetDir = PLUGIN_REPO + jobId.ToString() + "\\";
     44
     45      if (Directory.Exists(targetDir)) {
     46        Directory.Delete(targetDir, true);
     47      }
     48
     49      DirectoryInfo di = Directory.CreateDirectory(targetDir);
     50
     51      foreach (HivePluginInfoDto requestedPlugin in requests) {
     52        PluginDescription pd =
     53          cachedPlugins.Where(
     54            cp =>
     55            cp.Name == requestedPlugin.Name &&
     56            cp.Version.Major == requestedPlugin.Version.Major &&
     57            cp.Version.Minor == requestedPlugin.Version.Minor &&
     58            cp.Version.Revision >= requestedPlugin.Version.Revision).
     59            SingleOrDefault();
     60        if (pd == null) {
     61          return false;
     62        }
     63
     64        foreach (IPluginFile ipf in pd.Files) {
     65          File.Copy(ipf.Name, targetDir + ipf.Name.Split('\\').Last());
     66        }
     67      }
     68      return true;
     69    }
     70
     71    [MethodImpl(MethodImplOptions.Synchronized)]
     72    internal void PreparePlugins(List<HivePluginInfoDto> requiredPlugins) {
    3673      Logger.Debug("Fetching plugins for job");
    37       List<CachedHivePluginInfoDto> neededPlugins = new List<CachedHivePluginInfoDto>();
     74      List<HivePluginInfoDto> localPlugins = new List<HivePluginInfoDto>();
     75      List<HivePluginInfoDto> neededPlugins = new List<HivePluginInfoDto>();
    3876      List<HivePluginInfoDto> missingPlugins = new List<HivePluginInfoDto>();
    3977      bool found = false;
    40            
    41       foreach (HivePluginInfoDto info in requests) {
     78
     79      foreach (HivePluginInfoDto info in requiredPlugins) {
    4280        //we MAY run in problems here - if there is a plugin twice in requests, there may be added two different versions of the plugin
    43         foreach (CachedHivePluginInfoDto cache in pluginCache) {
    44           if (info.Name.Equals(cache.Name) && info.Version.Equals(cache.Version)) {
     81        foreach (PluginDescription cachedPlugin in cachedPlugins) {
     82          if (info.Name.Equals(cachedPlugin.Name)) {
    4583            Logger.Debug("Found plugin " + info.Name + ", " + info.Version);
    46             neededPlugins.Add(cache);
     84            localPlugins.Add(new HivePluginInfoDto() { Id = new Guid(), Name = info.Name, Version = info.Version, Update = true });
     85            neededPlugins.Add(info);
    4786            found = true;
     87
    4888            break;
    4989          }
    5090        }
    51         if (!found)
    52           Logger.Debug("Found NOT found " + info.Name + ", " + info.Version);
     91        if (!found) {
     92          Logger.Debug("Plugin NOT found " + info.Name + ", " + info.Version);
    5393          missingPlugins.Add(info);
     94        }
    5495        found = false;
    5596      }
    5697
    57       Logger.Debug("Requesting missing plugins");
    58       List<CachedHivePluginInfoDto> receivedPlugins = WcfService.Instance.RequestPlugins(missingPlugins);
    59       Logger.Debug("Requested missing plugins");
     98      Logger.Debug("First run - Update the plugins in the cache");
    6099
    61       if (receivedPlugins != null) {
    62         neededPlugins.AddRange(receivedPlugins);
    63         pluginCache.AddRange(receivedPlugins);
    64       } else
    65         Logger.Error("Fetching of the plugins failed!");
     100      localPlugins.AddRange(missingPlugins);
    66101
    67       return neededPlugins;
     102      List<CachedHivePluginInfoDto> updateablePlugins = WcfService.Instance.RequestPlugins(localPlugins);
     103
     104      foreach (CachedHivePluginInfoDto updateablePlugin in updateablePlugins) {
     105        PluginDescription pd =
     106          cachedPlugins.Where(cachedPlugin => cachedPlugin.Name.Equals(updateablePlugin.Name)).SingleOrDefault();
     107
     108        if (pd != null) {
     109          Logger.Debug("deleting old files");
     110          foreach (IPluginFile ipf in pd.Files) {
     111            File.Delete(ipf.Name);
     112          }
     113        }
     114
     115        Logger.Debug("deleted old files");
     116        Logger.Debug("creating new files");
     117
     118
     119
     120        foreach (HivePluginFile pf in updateablePlugin.PluginFiles) {
     121          File.WriteAllBytes(PLUGIN_REPO + pf.Name.Split('\\').Last(), pf.BinaryFile);
     122        }
     123
     124        Logger.Debug("created new files");
     125        DoUpdateRun();
     126      }
    68127    }
    69128
    70 
    71     internal void PreparePlugins(List<HivePluginInfoDto> requiredPlugins) {
    72       List<HivePluginInfoDto> missingPlugins = new List<HivePluginInfoDto>();
    73       foreach (HivePluginInfoDto requiredPlugin in requiredPlugins) {
    74         if(ApplicationManager.Manager.Plugins.Count(ipd => ipd.Version.Major == requiredPlugin.Version.Major && ipd.Version.Minor >= requiredPlugin.Version.Minor) == 0) {
    75           missingPlugins.Add(requiredPlugin);             
    76         }
     129    internal void DeletePluginsForJob(Guid id) {
     130      try {
     131        Logger.Debug("unloading...");
     132        Directory.Delete(Path.Combine(PLUGIN_REPO, id.ToString()), true);
     133      } catch (Exception ex) {
     134        Logger.Debug("failed while unloading " + id + " with exception " + ex);
    77135      }
    78 
    79       Logger.Debug("Requesting missing plugins");
    80       List<CachedHivePluginInfoDto> receivedPlugins = WcfService.Instance.RequestPlugins(missingPlugins);
    81       Logger.Debug("Requested missing plugins");
    82 
    83       foreach (CachedHivePluginInfoDto receivedPlugin in receivedPlugins) {
    84         foreach (HivePluginFile hpf in receivedPlugin.PluginFiles) {
    85           Logger.Info("writing file " + hpf.Name);
    86           File.WriteAllBytes("C:\\temp\\" + hpf.Name.Split('\\').Last(), hpf.BinaryFile);
    87         }       
    88       }
    89 
    90136    }
    91137  }
  • branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Client.ExecutionEngine/3.3/ExecutionEnginePlugin.cs

    r4107 r4141  
    3030  [PluginFile("HeuristicLab.Hive.Client.ExecutionEngine-3.3.dll", PluginFileType.Assembly)]
    3131  [PluginDependency("HeuristicLab.Core", "3.3")]
     32  [PluginDependency("HeuristicLab.Common", "3.3")]
    3233  [PluginDependency("HeuristicLab.Hive.Client.Common", "3.3")]
    3334  [PluginDependency("HeuristicLab.Hive.Client.Communication", "3.3")]
  • branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Client.ExecutionEngine/3.3/Executor.cs

    r4119 r4141  
    3636    public IJob Job { get; set; }
    3737    public MessageContainer.MessageType CurrentMessage { get; set; }
     38    public Exception CurrentException { get; set; }
    3839    public MessageQueue Queue { get; set; }
    3940
     
    6465
    6566    void Job_JobFailed(object sender, EventArgs e) {
    66       Queue.AddMessage(new MessageContainer(MessageContainer.MessageType.JobFailed, JobId));
     67      HeuristicLab.Common.EventArgs<Exception> ex = (HeuristicLab.Common.EventArgs<Exception>)e;
     68      CurrentException = ex.Value;
     69      Queue.AddMessage(new MessageContainer(MessageContainer.MessageType.FinishedJob, JobId));
    6770    }
    6871
  • branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Contracts/3.3/ApplicationConstants.cs

    r4092 r4141  
    8787    public static string RESPONSE_COMMUNICATOR_SEND_JOBRESULT = "Please send the Jobresult to the server";
    8888    public static string RESPONSE_COMMUNICATOR_PLUGINS_SENT = "Communicator.PluginsSent";
     89    public static string RESPONSE_COMMUNICATOR_PLUGINS_NOT_AVAIL = "Communicator.PluginsNotAvail";
    8990    public static string RESPONSE_COMMUNICATOR_JOB_WAS_ABORTED = "Job was aborted";
    9091
  • branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Contracts/3.3/BusinessObjects/ClientDto.cs

    r4133 r4141  
    2727using HeuristicLab.Common;
    2828using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    29                                    
     29
    3030namespace HeuristicLab.Hive.Contracts.BusinessObjects {
    3131
    32   public enum State { NullState, Idle, Calculating, Offline, Finished, Abort, RequestSnapshot, RequestSnapshotSent, Pending };
     32  public enum State { NullState, Idle, Calculating, Offline, Finished, Abort, RequestSnapshot, RequestSnapshotSent, Pending, Failed };
    3333  public enum CalendarState { Fetch, ForceFetch, Fetching, Fetched, NotAllowedToFetch };
    3434
  • branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Contracts/3.3/BusinessObjects/HivePluginInfoDto.cs

    r4133 r4141  
    4545    private string storableVersion;
    4646
     47    [Storable]
     48    [DataMember]
     49    public Boolean Update { get; set; }
     50
    4751    public HivePluginInfoDto() { }
    4852
     
    6468      clone.Name = this.Name;
    6569      clone.Version = (Version)this.Version.Clone();
     70      clone.Update = this.Update;
    6671      return clone;
    6772    }
  • branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Contracts/3.3/BusinessObjects/JobDto.cs

    r4133 r4141  
    5353    [Storable]
    5454    [DataMember]
     55    public String Exception { get; set; }
     56    [Storable]
     57    [DataMember]
    5558    public DateTime? DateCreated { get; set; }
    5659    [Storable]
     
    7982    public ProjectDto Project { get; set; }
    8083
     84   
     85
    8186    public override string ToString() {
    8287      return base.ToString() + "State: " + State + ", [Ressource : " + Client + " ] , DateCreated: " + DateCreated + ", DateCalculated: " + DateCalculated +
     
    98103      clone.DateCreated = this.DateCreated;
    99104      clone.DateFinished = this.DateFinished;
     105      clone.Exception = this.Exception;
    100106      clone.Id = this.Id;
    101107      clone.MemoryNeeded = this.MemoryNeeded;
  • branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Experiment.Views/3.3/JobItemView.Designer.cs

    r4133 r4141  
    5858      this.logTabPage = new System.Windows.Forms.TabPage();
    5959      this.logView = new HeuristicLab.Core.Views.LogView();
     60      this.requestSnapshotButton = new System.Windows.Forms.Button();
    6061      this.snapshotGroupBox.SuspendLayout();
    6162      this.jobStatusGroupBox.SuspendLayout();
     
    247248      this.snapshotGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    248249                  | System.Windows.Forms.AnchorStyles.Right)));
     250      this.snapshotGroupBox.Controls.Add(this.requestSnapshotButton);
    249251      this.snapshotGroupBox.Controls.Add(this.openSnapshotButton);
    250252      this.snapshotGroupBox.Controls.Add(this.snapshotTimeText);
     
    262264      //
    263265      this.openSnapshotButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
    264       this.openSnapshotButton.Location = new System.Drawing.Point(426, 67);
     266      this.openSnapshotButton.Location = new System.Drawing.Point(420, 67);
    265267      this.openSnapshotButton.Name = "openSnapshotButton";
    266       this.openSnapshotButton.Size = new System.Drawing.Size(101, 26);
     268      this.openSnapshotButton.Size = new System.Drawing.Size(107, 26);
    267269      this.openSnapshotButton.TabIndex = 25;
    268270      this.openSnapshotButton.Text = "Open Snapshot";
     
    415417      this.logView.Size = new System.Drawing.Size(536, 447);
    416418      this.logView.TabIndex = 0;
     419      //
     420      // requestSnapshotButton
     421      //
     422      this.requestSnapshotButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     423      this.requestSnapshotButton.Location = new System.Drawing.Point(307, 67);
     424      this.requestSnapshotButton.Name = "requestSnapshotButton";
     425      this.requestSnapshotButton.Size = new System.Drawing.Size(107, 26);
     426      this.requestSnapshotButton.TabIndex = 26;
     427      this.requestSnapshotButton.Text = "Request Snapshot";
     428      this.requestSnapshotButton.UseVisualStyleBackColor = true;
     429      this.requestSnapshotButton.Click += new System.EventHandler(this.requestSnapshotButton_Click);
    417430      //
    418431      // JobItemView
     
    471484    private System.Windows.Forms.TabPage logTabPage;
    472485    private Core.Views.LogView logView;
     486    private System.Windows.Forms.Button requestSnapshotButton;
    473487  }
    474488}
  • branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Experiment.Views/3.3/JobItemView.cs

    r4133 r4141  
    111111      MainFormManager.MainForm.ShowContent(job.Optimizer);
    112112    }
     113
     114    private void requestSnapshotButton_Click(object sender, EventArgs e) {
     115     
     116    }
    113117  }
    114118}
  • branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Experiment/3.3/HeuristicLab.Hive.Experiment-3.3.csproj

    r4139 r4141  
    9696  </ItemGroup>
    9797  <ItemGroup>
    98     <Compile Include="OptimizerList.cs" />
    9998    <Compile Include="JobItemList.cs" />
    10099    <Compile Include="JobItem.cs" />
  • branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Experiment/3.3/HiveExperiment.cs

    r4139 r4141  
    5353    private const string itemDescription = "A runner for a single experiment, which's algorithms are executed in the Hive.";
    5454    private const int resultPollingIntervalMs = 15000;
     55    private const int snapshotPollingIntervalMs = 1000;
    5556    private const int maxSnapshotRetries = 20;
    5657    private object locker = new object();
     
    169170      clone.executionTime = this.executionTime;
    170171      clone.pendingOptimizersByJobId = new Dictionary<Guid, IOptimizer>();
     172
    171173      foreach (var pair in this.pendingOptimizersByJobId)
    172174        clone.pendingOptimizersByJobId[pair.Key] = (IOptimizer)cloner.Clone(pair.Value);
     175
    173176      foreach (var pair in this.parentOptimizersByPendingOptimizer)
    174         clone.parentOptimizersByPendingOptimizer[pair.Key] = (IOptimizer)cloner.Clone(pair.Value);
     177        clone.parentOptimizersByPendingOptimizer[(IOptimizer)cloner.Clone(pair.Key)] = (IOptimizer)cloner.Clone(pair.Value);
     178
    175179      clone.log = (ILog)cloner.Clone(log);
    176180      clone.stopPending = this.stopPending;
     
    243247    public void Prepare() {
    244248      if (experiment != null) {
     249        StopResultPolling();
     250        pendingOptimizersByJobId.Clear();
     251        parentOptimizersByPendingOptimizer.Clear();
     252        jobItems.Clear();
    245253        experiment.Prepare();
    246254        this.ExecutionState = Core.ExecutionState.Prepared;
     
    251259    public void Start() {
    252260      OnStarted();
     261      ExecutionTime = new TimeSpan();
    253262      lastUpdateTime = DateTime.Now;
    254263      this.ExecutionState = Core.ExecutionState.Started;
     
    295304    private void CreateResultPollingThreads() {
    296305      foreach (JobItem jobItem in JobItems) {
    297         if (!resultPollingThreads.ContainsKey(jobItem.JobDto.Id)) {
     306        if (!resultPollingThreads.ContainsKey(jobItem.JobDto.Id) && jobItem.JobDto.State != State.Finished) {
    298307          resultPollingThreads.Add(jobItem.JobDto.Id, CreateResultPollingThread(jobItem.JobDto));
    299308        }
     
    303312    public void StartResultPolling() {
    304313      this.stopResultsPollingPending = false;
    305       CreateResultPollingThreads();
    306       foreach (Thread pollingThread in resultPollingThreads.Values) {
    307         if (pollingThread.ThreadState != System.Threading.ThreadState.Running) {
    308           pollingThread.Start();
    309         }
    310       }
    311314      this.IsPollingResults = true;
     315      lock (resultPollingThreads) {
     316        CreateResultPollingThreads();
     317        foreach (Thread pollingThread in resultPollingThreads.Values) {
     318          if (pollingThread.ThreadState != System.Threading.ThreadState.Running) {
     319            pollingThread.Start();
     320          }
     321        }
     322      }
    312323    }
    313324
     
    452463
    453464          do {
    454             Thread.Sleep(resultPollingIntervalMs);
    455465            if (stopPending || !this.IsPollingResults) {
    456466              return;
     
    479489              UpdateSnapshot(jobResponse);
    480490            }
     491
     492            Thread.Sleep(resultPollingIntervalMs);
    481493          } while (restoredObject == null || restoredObject.ExecutionState != Core.ExecutionState.Stopped);
    482494
     
    486498          IOptimizer originalOptimizer = pendingOptimizersByJobId[job.Id];
    487499          IOptimizer restoredOptimizer = ((OptimizerJob)restoredObject).Optimizer;
    488 
     500         
    489501          ReplaceOptimizer(parentOptimizersByPendingOptimizer[originalOptimizer], originalOptimizer, restoredOptimizer);
    490502          pendingOptimizersByJobId.Remove(job.Id);
    491503          parentOptimizersByPendingOptimizer.Remove(originalOptimizer);
    492504
     505        } catch (ThreadInterruptedException exception) {
     506
     507        } finally {
     508          GetJobItemById(job.Id).LogMessage("ResultsPolling Thread stopped");
     509          lock (resultPollingThreads) {
     510            resultPollingThreads.Remove(job.Id);
     511            if (resultPollingThreads.Count == 0) {
     512              IsPollingResults = false;
     513            }
     514          }
     515
     516          // check if finished
    493517          if (pendingOptimizersByJobId.Count == 0) {
    494             // finished
    495518            this.ExecutionState = Core.ExecutionState.Stopped;
    496519            OnStopped();
    497520          }
    498         } catch (ThreadInterruptedException exception) {
    499 
    500         } finally {
    501           GetJobItemById(job.Id).LogMessage("ResultsPolling Thread stopped");
    502           resultPollingThreads.Remove(job.Id);
    503           if (resultPollingThreads.Count == 0) {
    504             IsPollingResults = false;
    505           }
    506521        }
    507522      });
     
    519534
    520535    private void LogMessage(string message) {
    521       // HeuristicLab.Log is not Thread-Safe, so lock every call
     536      // HeuristicLab.Log is not Thread-Safe, so lock on every call
    522537      lock (locker) {
    523538        log.LogMessage(message);
     539      }
     540    }
     541
     542    public void RequestSnapshot(Guid jobId) {
     543      IExecutionEngineFacade executionEngineFacade = GetExecutionEngineFacade();
     544      ResponseObject<SerializedJob> response;
     545      int retryCount = 0;
     546
     547      Response snapShotResponse = executionEngineFacade.RequestSnapshot(jobId);
     548      if (snapShotResponse.StatusMessage == ApplicationConstants.RESPONSE_JOB_IS_NOT_BEEING_CALCULATED) {
     549        // job already finished
     550        Logger.Debug("HiveEngine: Abort - GetLastResult(false)");
     551        response = executionEngineFacade.GetLastSerializedResult(jobId, false, false);
     552        Logger.Debug("HiveEngine: Abort - Server: " + response.StatusMessage + " success: " + response.Success);
     553      } else {
     554        // server sent snapshot request to client
     555        // poll until snapshot is ready
     556        do {
     557          Thread.Sleep(snapshotPollingIntervalMs);
     558          Logger.Debug("HiveEngine: Abort - GetLastResult(true)");
     559          response = executionEngineFacade.GetLastSerializedResult(jobId, false, true);
     560          Logger.Debug("HiveEngine: Abort - Server: " + response.StatusMessage + " success: " + response.Success);
     561          retryCount++;
     562          // loop while
     563          // 1. problem with communication with server
     564          // 2. job result not yet ready
     565        } while (
     566          (retryCount < maxSnapshotRetries) && (
     567          !response.Success ||
     568          response.StatusMessage == ApplicationConstants.RESPONSE_JOB_RESULT_NOT_YET_HERE)
     569          );
     570      }
     571      SerializedJob jobResult = response.Obj;
     572      if (jobResult != null) {
     573        Logger.Debug("HiveEngine: Results-polling - Got result!");
     574
     575        //job = XmlParser.Deserialize<Job>(new MemoryStream(jobResult.SerializedJobData));
     576
     577        throw new NotImplementedException("[chn] how to create a view in 3.3 and why should i do this here? shouldnt the caller of this method receive a result and decide what to do?");
     578        //ControlManager.Manager.ShowControl(job.Engine.CreateView());
    524579      }
    525580    }
  • branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Server.Core/3.3/ClientCommunicator.cs

    r4135 r4141  
    140140        }
    141141        CheckForPendingJobs();
    142 //        DaoLocator.DestroyContext();
     142        //        DaoLocator.DestroyContext();
    143143        scope.Complete();
    144144      }
     
    591591      job.JobInfo.Percentage = percentage;
    592592
    593       if (finished) {
     593      if (exception != null) {
     594        job.JobInfo.State = State.Failed;
     595        job.JobInfo.Exception = exception.ToString();
     596        job.JobInfo.DateFinished = DateTime.Now;
     597      } else if (finished) {
    594598        job.JobInfo.State = State.Finished;
    595599        job.JobInfo.DateFinished = DateTime.Now;
     
    710714      ResponsePlugin response = new ResponsePlugin();
    711715      foreach (HivePluginInfoDto pluginInfo in pluginList) {
    712         // TODO: Split version to major, minor and revision number
    713         foreach (IPluginDescription currPlugin in ApplicationManager.Manager.Plugins) {
    714           if (currPlugin.Name == pluginInfo.Name) {
    715 
    716             CachedHivePluginInfoDto currCachedPlugin = new CachedHivePluginInfoDto {
    717               Name = currPlugin.Name,
    718               Version = currPlugin.Version
    719             };
    720 
    721             foreach (string fileName in from file in currPlugin.Files select file.Name) {
    722               currCachedPlugin.PluginFiles.Add(new HivePluginFile(File.ReadAllBytes(fileName), fileName));
    723             }
    724             response.Plugins.Add(currCachedPlugin);
     716        if (pluginInfo.Update) {
     717          //check if there is a newer version         
     718          IPluginDescription ipd =
     719            ApplicationManager.Manager.Plugins.Where(pd => pd.Name == pluginInfo.Name && pd.Version.Major == pluginInfo.Version.Major && pd.Version.Minor == pluginInfo.Version.Minor && pd.Version.Revision > pluginInfo.Version.Revision).SingleOrDefault();
     720          if (ipd != null) {
     721            response.Plugins.Add(convertPluginDescriptorToDto(ipd));
     722          }
     723        } else {
     724          IPluginDescription ipd =
     725            ApplicationManager.Manager.Plugins.Where(pd => pd.Name == pluginInfo.Name && pd.Version.Major == pluginInfo.Version.Major && pd.Version.Minor == pluginInfo.Version.Minor && pd.Version.Revision >= pluginInfo.Version.Revision).SingleOrDefault();
     726          if (ipd != null) {
     727            response.Plugins.Add(convertPluginDescriptorToDto(ipd));
     728          } else {
     729            response.Success = false;
     730            response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_PLUGINS_NOT_AVAIL;
     731            return response;
    725732          }
    726733        }
     
    730737
    731738      return response;
     739    }
     740
     741    private CachedHivePluginInfoDto convertPluginDescriptorToDto(IPluginDescription currPlugin) {
     742      CachedHivePluginInfoDto currCachedPlugin = new CachedHivePluginInfoDto {
     743        Name = currPlugin.Name,
     744        Version = currPlugin.Version
     745      };
     746
     747      foreach (string fileName in from file in currPlugin.Files select file.Name) {
     748        currCachedPlugin.PluginFiles.Add(new HivePluginFile(File.ReadAllBytes(fileName), fileName));
     749      }
     750      return currCachedPlugin;
    732751    }
    733752
  • branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Server.Core/3.3/DbTestApp.cs

    r4116 r4141  
    232232      using (contextFactory.GetContext()) {
    233233        //TestLINQImplementation();
    234         TestLinqFileHandling();
     234        //TestLinqFileHandling();
    235235
    236236        //StressTest();
  • branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Server.LINQDataAccess/3.3/HiveDataContext.cs

    r3931 r4141  
    33// <auto-generated>
    44//     This code was generated by a tool.
    5 //     Runtime Version:2.0.50727.4927
     5//     Runtime Version:4.0.30319.1
    66//
    77//     Changes to this file may cause incorrect behavior and will be lost if
     
    2323 
    2424 
    25   [System.Data.Linq.Mapping.DatabaseAttribute(Name="HeuristicLab.Hive.Linq.Test")]
     25  [global::System.Data.Linq.Mapping.DatabaseAttribute(Name="HeuristicLab.Hive")]
    2626  public partial class HiveDataContext : System.Data.Linq.DataContext
    2727  {
     
    168168  }
    169169 
    170   [Table(Name="dbo.AssignedResources")]
     170  [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.AssignedResources")]
    171171  public partial class AssignedResource : INotifyPropertyChanging, INotifyPropertyChanged
    172172  {
     
    203203    }
    204204   
    205     [Column(Storage="_ResourceId", DbType="UniqueIdentifier NOT NULL")]
     205    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ResourceId", DbType="UniqueIdentifier NOT NULL")]
    206206    public System.Guid ResourceId
    207207    {
     
    227227    }
    228228   
    229     [Column(Storage="_JobId", DbType="UniqueIdentifier NOT NULL")]
     229    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_JobId", DbType="UniqueIdentifier NOT NULL")]
    230230    public System.Guid JobId
    231231    {
     
    251251    }
    252252   
    253     [Column(Storage="_AssignedRessourcesId", AutoSync=AutoSync.OnInsert, DbType="UniqueIdentifier NOT NULL", IsPrimaryKey=true, IsDbGenerated=true)]
     253    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_AssignedRessourcesId", AutoSync=AutoSync.OnInsert, DbType="UniqueIdentifier NOT NULL", IsPrimaryKey=true, IsDbGenerated=true)]
    254254    public System.Guid AssignedRessourcesId
    255255    {
     
    271271    }
    272272   
    273     [Association(Name="Resource_AssignedResource", Storage="_Resource", ThisKey="ResourceId", OtherKey="ResourceId", IsForeignKey=true, DeleteRule="CASCADE")]
     273    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Resource_AssignedResource", Storage="_Resource", ThisKey="ResourceId", OtherKey="ResourceId", IsForeignKey=true, DeleteRule="CASCADE")]
    274274    public Resource Resource
    275275    {
     
    305305    }
    306306   
    307     [Association(Name="Job_AssignedResource", Storage="_Job", ThisKey="JobId", OtherKey="JobId", IsForeignKey=true, DeleteRule="CASCADE")]
     307    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Job_AssignedResource", Storage="_Job", ThisKey="JobId", OtherKey="JobId", IsForeignKey=true, DeleteRule="CASCADE")]
    308308    public Job Job
    309309    {
     
    360360  }
    361361 
    362   [Table(Name="dbo.UptimeStatistics")]
     362  [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.UptimeStatistics")]
    363363  public partial class UptimeStatistic : INotifyPropertyChanging, INotifyPropertyChanged
    364364  {
     
    396396    }
    397397   
    398     [Column(Storage="_UptimeStatisticsId", AutoSync=AutoSync.OnInsert, DbType="UniqueIdentifier NOT NULL", IsPrimaryKey=true, IsDbGenerated=true)]
     398    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UptimeStatisticsId", AutoSync=AutoSync.OnInsert, DbType="UniqueIdentifier NOT NULL", IsPrimaryKey=true, IsDbGenerated=true)]
    399399    public System.Guid UptimeStatisticsId
    400400    {
     
    416416    }
    417417   
    418     [Column(Storage="_Login", DbType="DateTime")]
     418    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Login", DbType="DateTime")]
    419419    public System.DateTime Login
    420420    {
     
    436436    }
    437437   
    438     [Column(Storage="_Logout", DbType="DateTime")]
     438    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Logout", DbType="DateTime")]
    439439    public System.DateTime Logout
    440440    {
     
    456456    }
    457457   
    458     [Column(Storage="_ResourceId", DbType="UniqueIdentifier")]
     458    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ResourceId", DbType="UniqueIdentifier")]
    459459    public System.Guid ResourceId
    460460    {
     
    480480    }
    481481   
    482     [Association(Name="Client_UptimeStatistic", Storage="_Client", ThisKey="ResourceId", OtherKey="ResourceId", IsForeignKey=true, DeleteRule="SET NULL")]
     482    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Client_UptimeStatistic", Storage="_Client", ThisKey="ResourceId", OtherKey="ResourceId", IsForeignKey=true, DeleteRule="SET NULL")]
    483483    public Client Client
    484484    {
     
    535535  }
    536536 
    537   [Table(Name="dbo.ClientConfig")]
     537  [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.ClientConfig")]
    538538  public partial class ClientConfig : INotifyPropertyChanging, INotifyPropertyChanged
    539539  {
     
    567567    }
    568568   
    569     [Column(Storage="_ClientConfigId", AutoSync=AutoSync.OnInsert, DbType="UniqueIdentifier NOT NULL", IsPrimaryKey=true, IsDbGenerated=true)]
     569    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ClientConfigId", AutoSync=AutoSync.OnInsert, DbType="UniqueIdentifier NOT NULL", IsPrimaryKey=true, IsDbGenerated=true)]
    570570    public System.Guid ClientConfigId
    571571    {
     
    587587    }
    588588   
    589     [Column(Storage="_UpDownTimeCalendar", DbType="Xml", UpdateCheck=UpdateCheck.Never)]
     589    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UpDownTimeCalendar", DbType="Xml", UpdateCheck=UpdateCheck.Never)]
    590590    public System.Xml.Linq.XElement UpDownTimeCalendar
    591591    {
     
    607607    }
    608608   
    609     [Column(Storage="_HeartBeatIntervall", DbType="Int")]
     609    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_HeartBeatIntervall", DbType="Int")]
    610610    public System.Nullable<int> HeartBeatIntervall
    611611    {
     
    627627    }
    628628   
    629     [Association(Name="ClientConfig_Client", Storage="_Clients", ThisKey="ClientConfigId", OtherKey="ClientConfigId")]
     629    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="ClientConfig_Client", Storage="_Clients", ThisKey="ClientConfigId", OtherKey="ClientConfigId")]
    630630    public EntitySet<Client> Clients
    631631    {
     
    673673  }
    674674 
    675   [Table(Name="dbo.ClientGroup_Resource")]
     675  [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.ClientGroup_Resource")]
    676676  public partial class ClientGroup_Resource : INotifyPropertyChanging, INotifyPropertyChanged
    677677  {
     
    708708    }
    709709   
    710     [Column(Storage="_ClientGroup_RessourceId", AutoSync=AutoSync.OnInsert, DbType="UniqueIdentifier NOT NULL", IsPrimaryKey=true, IsDbGenerated=true)]
     710    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ClientGroup_RessourceId", AutoSync=AutoSync.OnInsert, DbType="UniqueIdentifier NOT NULL", IsPrimaryKey=true, IsDbGenerated=true)]
    711711    public System.Guid ClientGroup_RessourceId
    712712    {
     
    728728    }
    729729   
    730     [Column(Storage="_ClientGroupId", DbType="UniqueIdentifier NOT NULL")]
     730    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ClientGroupId", DbType="UniqueIdentifier NOT NULL")]
    731731    public System.Guid ClientGroupId
    732732    {
     
    752752    }
    753753   
    754     [Column(Storage="_ResourceId", DbType="UniqueIdentifier NOT NULL")]
     754    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ResourceId", DbType="UniqueIdentifier NOT NULL")]
    755755    public System.Guid ResourceId
    756756    {
     
    776776    }
    777777   
    778     [Association(Name="ClientGroup_ClientGroup_Resource", Storage="_ClientGroup", ThisKey="ClientGroupId", OtherKey="ResourceId", IsForeignKey=true)]
     778    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="ClientGroup_ClientGroup_Resource", Storage="_ClientGroup", ThisKey="ClientGroupId", OtherKey="ResourceId", IsForeignKey=true)]
    779779    public ClientGroup ClientGroup
    780780    {
     
    810810    }
    811811   
    812     [Association(Name="Resource_ClientGroup_Resource", Storage="_Resource", ThisKey="ResourceId", OtherKey="ResourceId", IsForeignKey=true, DeleteRule="CASCADE")]
     812    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Resource_ClientGroup_Resource", Storage="_Resource", ThisKey="ResourceId", OtherKey="ResourceId", IsForeignKey=true, DeleteRule="CASCADE")]
    813813    public Resource Resource
    814814    {
     
    865865  }
    866866 
    867   [Table(Name="dbo.PluginInfo")]
     867  [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.PluginInfo")]
    868868  public partial class PluginInfo : INotifyPropertyChanging, INotifyPropertyChanged
    869869  {
     
    901901    }
    902902   
    903     [Column(Storage="_PluginId", AutoSync=AutoSync.OnInsert, DbType="UniqueIdentifier NOT NULL", IsPrimaryKey=true, IsDbGenerated=true)]
     903    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_PluginId", AutoSync=AutoSync.OnInsert, DbType="UniqueIdentifier NOT NULL", IsPrimaryKey=true, IsDbGenerated=true)]
    904904    public System.Guid PluginId
    905905    {
     
    921921    }
    922922   
    923     [Column(Storage="_Name", DbType="VarChar(MAX)")]
     923    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Name", DbType="VarChar(MAX)")]
    924924    public string Name
    925925    {
     
    941941    }
    942942   
    943     [Column(Storage="_Version", DbType="VarChar(MAX)")]
     943    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Version", DbType="VarChar(MAX)")]
    944944    public string Version
    945945    {
     
    961961    }
    962962   
    963     [Column(Storage="_BuildDate", DbType="VarChar(20)")]
     963    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_BuildDate", DbType="VarChar(20)")]
    964964    public string BuildDate
    965965    {
     
    981981    }
    982982   
    983     [Association(Name="PluginInfo_RequiredPlugin", Storage="_RequiredPlugins", ThisKey="PluginId", OtherKey="PluginId")]
     983    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="PluginInfo_RequiredPlugin", Storage="_RequiredPlugins", ThisKey="PluginId", OtherKey="PluginId")]
    984984    public EntitySet<RequiredPlugin> RequiredPlugins
    985985    {
     
    10271027  }
    10281028 
    1029   [Table(Name="dbo.Project")]
     1029  [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.Project")]
    10301030  public partial class Project : INotifyPropertyChanging, INotifyPropertyChanged
    10311031  {
     
    10551055    }
    10561056   
    1057     [Column(Storage="_ProjectId", AutoSync=AutoSync.OnInsert, DbType="UniqueIdentifier NOT NULL", IsPrimaryKey=true, IsDbGenerated=true)]
     1057    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ProjectId", AutoSync=AutoSync.OnInsert, DbType="UniqueIdentifier NOT NULL", IsPrimaryKey=true, IsDbGenerated=true)]
    10581058    public System.Guid ProjectId
    10591059    {
     
    10751075    }
    10761076   
    1077     [Column(Storage="_Name", DbType="VarChar(MAX)")]
     1077    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Name", DbType="VarChar(MAX)")]
    10781078    public string Name
    10791079    {
     
    10951095    }
    10961096   
    1097     [Association(Name="Project_Job", Storage="_Jobs", ThisKey="ProjectId", OtherKey="ProjectId")]
     1097    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Project_Job", Storage="_Jobs", ThisKey="ProjectId", OtherKey="ProjectId")]
    10981098    public EntitySet<Job> Jobs
    10991099    {
     
    11411141  }
    11421142 
    1143   [Table(Name="dbo.RequiredPlugins")]
     1143  [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.RequiredPlugins")]
    11441144  public partial class RequiredPlugin : INotifyPropertyChanging, INotifyPropertyChanged
    11451145  {
     
    11761176    }
    11771177   
    1178     [Column(Storage="_RequiredPluginId", AutoSync=AutoSync.OnInsert, DbType="UniqueIdentifier NOT NULL", IsPrimaryKey=true, IsDbGenerated=true, UpdateCheck=UpdateCheck.Never)]
     1178    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_RequiredPluginId", AutoSync=AutoSync.OnInsert, DbType="UniqueIdentifier NOT NULL", IsPrimaryKey=true, IsDbGenerated=true, UpdateCheck=UpdateCheck.Never)]
    11791179    public System.Guid RequiredPluginId
    11801180    {
     
    11961196    }
    11971197   
    1198     [Column(Storage="_JobId", DbType="UniqueIdentifier NOT NULL")]
     1198    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_JobId", DbType="UniqueIdentifier NOT NULL")]
    11991199    public System.Guid JobId
    12001200    {
     
    12201220    }
    12211221   
    1222     [Column(Storage="_PluginId", DbType="UniqueIdentifier NOT NULL")]
     1222    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_PluginId", DbType="UniqueIdentifier NOT NULL")]
    12231223    public System.Guid PluginId
    12241224    {
     
    12441244    }
    12451245   
    1246     [Association(Name="PluginInfo_RequiredPlugin", Storage="_PluginInfo", ThisKey="PluginId", OtherKey="PluginId", IsForeignKey=true, DeleteRule="CASCADE")]
     1246    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="PluginInfo_RequiredPlugin", Storage="_PluginInfo", ThisKey="PluginId", OtherKey="PluginId", IsForeignKey=true, DeleteRule="CASCADE")]
    12471247    public PluginInfo PluginInfo
    12481248    {
     
    12781278    }
    12791279   
    1280     [Association(Name="Job_RequiredPlugin", Storage="_Job", ThisKey="JobId", OtherKey="JobId", IsForeignKey=true)]
     1280    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Job_RequiredPlugin", Storage="_Job", ThisKey="JobId", OtherKey="JobId", IsForeignKey=true)]
    12811281    public Job Job
    12821282    {
     
    13331333  }
    13341334 
    1335   [Table(Name="dbo.Resource")]
    1336   [InheritanceMapping(Code="RESOURCE", Type=typeof(Resource))]
    1337   [InheritanceMapping(Code="CLIENT", Type=typeof(Client), IsDefault=true)]
    1338   [InheritanceMapping(Code="GROUP", Type=typeof(ClientGroup))]
     1335  [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.Resource")]
     1336  [global::System.Data.Linq.Mapping.InheritanceMappingAttribute(Code="RESOURCE", Type=typeof(Resource))]
     1337  [global::System.Data.Linq.Mapping.InheritanceMappingAttribute(Code="CLIENT", Type=typeof(Client), IsDefault=true)]
     1338  [global::System.Data.Linq.Mapping.InheritanceMappingAttribute(Code="GROUP", Type=typeof(ClientGroup))]
    13391339  public partial class Resource : INotifyPropertyChanging, INotifyPropertyChanged
    13401340  {
     
    13741374    }
    13751375   
    1376     [Column(Storage="_ResourceId", AutoSync=AutoSync.OnInsert, DbType="UniqueIdentifier NOT NULL", IsPrimaryKey=true)]
     1376    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ResourceId", AutoSync=AutoSync.OnInsert, DbType="UniqueIdentifier NOT NULL", IsPrimaryKey=true)]
    13771377    public System.Guid ResourceId
    13781378    {
     
    13941394    }
    13951395   
    1396     [Column(Storage="_Name", DbType="VarChar(MAX)")]
     1396    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Name", DbType="VarChar(MAX)")]
    13971397    public string Name
    13981398    {
     
    14141414    }
    14151415   
    1416     [Column(Storage="_ResourceType", IsDiscriminator=true)]
     1416    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ResourceType", IsDiscriminator=true)]
    14171417    public string ResourceType
    14181418    {
     
    14341434    }
    14351435   
    1436     [Association(Name="Resource_AssignedResource", Storage="_AssignedResources", ThisKey="ResourceId", OtherKey="ResourceId")]
     1436    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Resource_AssignedResource", Storage="_AssignedResources", ThisKey="ResourceId", OtherKey="ResourceId")]
    14371437    public EntitySet<AssignedResource> AssignedResources
    14381438    {
     
    14471447    }
    14481448   
    1449     [Association(Name="Resource_ClientGroup_Resource", Storage="_ClientGroup_Resources_Parents", ThisKey="ResourceId", OtherKey="ResourceId")]
     1449    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Resource_ClientGroup_Resource", Storage="_ClientGroup_Resources_Parents", ThisKey="ResourceId", OtherKey="ResourceId")]
    14501450    public EntitySet<ClientGroup_Resource> ClientGroup_Resources_Parents
    14511451    {
     
    14601460    }
    14611461   
    1462     [Association(Name="Resource_UptimeCalendar", Storage="_UptimeCalendars", ThisKey="ResourceId", OtherKey="ResourceId")]
     1462    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Resource_UptimeCalendar", Storage="_UptimeCalendars", ThisKey="ResourceId", OtherKey="ResourceId")]
    14631463    public EntitySet<UptimeCalendar> UptimeCalendars
    14641464    {
     
    15931593    }
    15941594   
    1595     [Column(Storage="_CPUSpeed", DbType="Int")]
     1595    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_CPUSpeed", DbType="Int")]
    15961596    public System.Nullable<int> CPUSpeed
    15971597    {
     
    16131613    }
    16141614   
    1615     [Column(Storage="_Memory", DbType="Int")]
     1615    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Memory", DbType="Int")]
    16161616    public System.Nullable<int> Memory
    16171617    {
     
    16331633    }
    16341634   
    1635     [Column(Storage="_Login", DbType="DateTime")]
     1635    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Login", DbType="DateTime")]
    16361636    public System.Nullable<System.DateTime> Login
    16371637    {
     
    16531653    }
    16541654   
    1655     [Column(Storage="_Status", DbType="VarChar(MAX)")]
     1655    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Status", DbType="VarChar(MAX)")]
    16561656    public string Status
    16571657    {
     
    16731673    }
    16741674   
    1675     [Column(Storage="_CalendarSyncStatus", DbType="VarChar(MAX)")]
     1675    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_CalendarSyncStatus", DbType="VarChar(MAX)")]
    16761676    public string CalendarSyncStatus
    16771677    {
     
    16931693    }
    16941694   
    1695     [Column(Storage="_UseCalendarFromResourceId", DbType="UniqueIdentifier")]
     1695    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UseCalendarFromResourceId", DbType="UniqueIdentifier")]
    16961696    public System.Nullable<System.Guid> UseCalendarFromResourceId
    16971697    {
     
    17131713    }
    17141714   
    1715     [Column(Storage="_ClientConfigId", DbType="UniqueIdentifier")]
     1715    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ClientConfigId", DbType="UniqueIdentifier")]
    17161716    public System.Nullable<System.Guid> ClientConfigId
    17171717    {
     
    17371737    }
    17381738   
    1739     [Column(Storage="_NumberOfCores", DbType="Int")]
     1739    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_NumberOfCores", DbType="Int")]
    17401740    public System.Nullable<int> NumberOfCores
    17411741    {
     
    17571757    }
    17581758   
    1759     [Column(Storage="_NumberOfFreeCores", DbType="Int")]
     1759    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_NumberOfFreeCores", DbType="Int")]
    17601760    public System.Nullable<int> NumberOfFreeCores
    17611761    {
     
    17771777    }
    17781778   
    1779     [Column(Storage="_FreeMemory", DbType="Int")]
     1779    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_FreeMemory", DbType="Int")]
    17801780    public System.Nullable<int> FreeMemory
    17811781    {
     
    17971797    }
    17981798   
    1799     [Association(Name="Client_UptimeStatistic", Storage="_UptimeStatistics", ThisKey="ResourceId", OtherKey="ResourceId")]
     1799    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Client_UptimeStatistic", Storage="_UptimeStatistics", ThisKey="ResourceId", OtherKey="ResourceId")]
    18001800    public EntitySet<UptimeStatistic> UptimeStatistics
    18011801    {
     
    18101810    }
    18111811   
    1812     [Association(Name="Client_Job", Storage="_Jobs", ThisKey="ResourceId", OtherKey="ResourceId", DeleteRule="SET NULL")]
     1812    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Client_Job", Storage="_Jobs", ThisKey="ResourceId", OtherKey="ResourceId", DeleteRule="SET NULL")]
    18131813    public EntitySet<Job> Jobs
    18141814    {
     
    18231823    }
    18241824   
    1825     [Association(Name="ClientConfig_Client", Storage="_ClientConfig", ThisKey="ClientConfigId", OtherKey="ClientConfigId", IsForeignKey=true, DeleteRule="SET NULL")]
     1825    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="ClientConfig_Client", Storage="_ClientConfig", ThisKey="ClientConfigId", OtherKey="ClientConfigId", IsForeignKey=true, DeleteRule="SET NULL")]
    18261826    public ClientConfig ClientConfig
    18271827    {
     
    18991899    }
    19001900   
    1901     [Association(Name="ClientGroup_ClientGroup_Resource", Storage="_ClientGroup_Resources_Children", ThisKey="ResourceId", OtherKey="ClientGroupId")]
     1901    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="ClientGroup_ClientGroup_Resource", Storage="_ClientGroup_Resources_Children", ThisKey="ResourceId", OtherKey="ClientGroupId")]
    19021902    public EntitySet<ClientGroup_Resource> ClientGroup_Resources_Children
    19031903    {
     
    19251925  }
    19261926 
    1927   [Table(Name="dbo.Job")]
     1927  [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.Job")]
    19281928  public partial class Job : INotifyPropertyChanging, INotifyPropertyChanged
    19291929  {
     
    19401940   
    19411941    private System.Nullable<double> _Percentage;
     1942   
     1943    private string _Exception;
    19421944   
    19431945    private System.Data.Linq.Link<System.Data.Linq.Binary> _SerializedJob;
     
    19851987    partial void OnPercentageChanging(System.Nullable<double> value);
    19861988    partial void OnPercentageChanged();
     1989    partial void OnExceptionChanging(string value);
     1990    partial void OnExceptionChanged();
    19871991    partial void OnSerializedJobChanging(System.Data.Linq.Binary value);
    19881992    partial void OnSerializedJobChanged();
     
    20162020    }
    20172021   
    2018     [Column(Storage="_JobId", AutoSync=AutoSync.OnInsert, DbType="UniqueIdentifier NOT NULL", IsPrimaryKey=true, IsDbGenerated=true)]
     2022    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_JobId", AutoSync=AutoSync.OnInsert, DbType="UniqueIdentifier NOT NULL", IsPrimaryKey=true, IsDbGenerated=true)]
    20192023    public System.Guid JobId
    20202024    {
     
    20362040    }
    20372041   
    2038     [Column(Storage="_ParentJobId", DbType="UniqueIdentifier")]
     2042    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ParentJobId", DbType="UniqueIdentifier")]
    20392043    public System.Nullable<System.Guid> ParentJobId
    20402044    {
     
    20602064    }
    20612065   
    2062     [Column(Storage="_JobState", DbType="VarChar(MAX)")]
     2066    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_JobState", DbType="VarChar(MAX)")]
    20632067    public string JobState
    20642068    {
     
    20802084    }
    20812085   
    2082     [Column(Storage="_ResourceId", DbType="UniqueIdentifier")]
     2086    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ResourceId", DbType="UniqueIdentifier")]
    20832087    public System.Nullable<System.Guid> ResourceId
    20842088    {
     
    21042108    }
    21052109   
    2106     [Column(Storage="_Percentage", DbType="Float")]
     2110    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Percentage", DbType="Float")]
    21072111    public System.Nullable<double> Percentage
    21082112    {
     
    21242128    }
    21252129   
    2126     [Column(Storage="_SerializedJob", DbType="VarBinary(MAX)", UpdateCheck=UpdateCheck.Never)]
     2130    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Exception", DbType="VarChar(MAX)")]
     2131    public string Exception
     2132    {
     2133      get
     2134      {
     2135        return this._Exception;
     2136      }
     2137      set
     2138      {
     2139        if ((this._Exception != value))
     2140        {
     2141          this.OnExceptionChanging(value);
     2142          this.SendPropertyChanging();
     2143          this._Exception = value;
     2144          this.SendPropertyChanged("Exception");
     2145          this.OnExceptionChanged();
     2146        }
     2147      }
     2148    }
     2149   
     2150    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_SerializedJob", DbType="VarBinary(MAX)", UpdateCheck=UpdateCheck.Never)]
    21272151    public System.Data.Linq.Binary SerializedJob
    21282152    {
     
    21442168    }
    21452169   
    2146     [Column(Storage="_DateCreated", DbType="DateTime")]
     2170    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_DateCreated", DbType="DateTime")]
    21472171    public System.Nullable<System.DateTime> DateCreated
    21482172    {
     
    21642188    }
    21652189   
    2166     [Column(Storage="_DateCalculated", DbType="DateTime")]
     2190    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_DateCalculated", DbType="DateTime")]
    21672191    public System.Nullable<System.DateTime> DateCalculated
    21682192    {
     
    21842208    }
    21852209   
    2186     [Column(Storage="_DateFinished", DbType="DateTime")]
     2210    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_DateFinished", DbType="DateTime")]
    21872211    public System.Nullable<System.DateTime> DateFinished
    21882212    {
     
    22042228    }
    22052229   
    2206     [Column(Storage="_Priority", DbType="Int NOT NULL")]
     2230    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Priority", DbType="Int NOT NULL")]
    22072231    public int Priority
    22082232    {
     
    22242248    }
    22252249   
    2226     [Column(Storage="_ProjectId", DbType="UniqueIdentifier")]
     2250    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ProjectId", DbType="UniqueIdentifier")]
    22272251    public System.Nullable<System.Guid> ProjectId
    22282252    {
     
    22482272    }
    22492273   
    2250     [Column(Storage="_UserId", DbType="UniqueIdentifier")]
     2274    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UserId", DbType="UniqueIdentifier")]
    22512275    public System.Nullable<System.Guid> UserId
    22522276    {
     
    22682292    }
    22692293   
    2270     [Column(Storage="_CoresNeeded", DbType="Int NOT NULL")]
     2294    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_CoresNeeded", DbType="Int NOT NULL")]
    22712295    public int CoresNeeded
    22722296    {
     
    22882312    }
    22892313   
    2290     [Column(Storage="_MemoryNeeded", DbType="Int NOT NULL")]
     2314    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_MemoryNeeded", DbType="Int NOT NULL")]
    22912315    public int MemoryNeeded
    22922316    {
     
    23082332    }
    23092333   
    2310     [Association(Name="Job_AssignedResource", Storage="_AssignedResources", ThisKey="JobId", OtherKey="JobId")]
     2334    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Job_AssignedResource", Storage="_AssignedResources", ThisKey="JobId", OtherKey="JobId")]
    23112335    public EntitySet<AssignedResource> AssignedResources
    23122336    {
     
    23212345    }
    23222346   
    2323     [Association(Name="Job_RequiredPlugin", Storage="_RequiredPlugins", ThisKey="JobId", OtherKey="JobId")]
     2347    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Job_RequiredPlugin", Storage="_RequiredPlugins", ThisKey="JobId", OtherKey="JobId")]
    23242348    public EntitySet<RequiredPlugin> RequiredPlugins
    23252349    {
     
    23342358    }
    23352359   
    2336     [Association(Name="Job_Job", Storage="_Jobs", ThisKey="JobId", OtherKey="ParentJobId")]
     2360    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Job_Job", Storage="_Jobs", ThisKey="JobId", OtherKey="ParentJobId")]
    23372361    public EntitySet<Job> Jobs
    23382362    {
     
    23472371    }
    23482372   
    2349     [Association(Name="Job_Job", Storage="_Job1", ThisKey="ParentJobId", OtherKey="JobId", IsForeignKey=true)]
     2373    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Job_Job", Storage="_Job1", ThisKey="ParentJobId", OtherKey="JobId", IsForeignKey=true)]
    23502374    public Job Job1
    23512375    {
     
    23812405    }
    23822406   
    2383     [Association(Name="Project_Job", Storage="_Project", ThisKey="ProjectId", OtherKey="ProjectId", IsForeignKey=true, DeleteRule="SET NULL")]
     2407    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Project_Job", Storage="_Project", ThisKey="ProjectId", OtherKey="ProjectId", IsForeignKey=true, DeleteRule="SET NULL")]
    23842408    public Project Project
    23852409    {
     
    24152439    }
    24162440   
    2417     [Association(Name="Client_Job", Storage="_Client", ThisKey="ResourceId", OtherKey="ResourceId", IsForeignKey=true, DeleteRule="SET NULL")]
     2441    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Client_Job", Storage="_Client", ThisKey="ResourceId", OtherKey="ResourceId", IsForeignKey=true, DeleteRule="SET NULL")]
    24182442    public Client Client
    24192443    {
     
    25062530  }
    25072531 
    2508   [Table(Name="dbo.UptimeCalendar")]
     2532  [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.UptimeCalendar")]
    25092533  public partial class UptimeCalendar : INotifyPropertyChanging, INotifyPropertyChanged
    25102534  {
     
    25542578    }
    25552579   
    2556     [Column(Storage="_UptimeCalendarId", AutoSync=AutoSync.OnInsert, DbType="UniqueIdentifier NOT NULL", IsPrimaryKey=true, IsDbGenerated=true)]
     2580    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UptimeCalendarId", AutoSync=AutoSync.OnInsert, DbType="UniqueIdentifier NOT NULL", IsPrimaryKey=true, IsDbGenerated=true)]
    25572581    public System.Guid UptimeCalendarId
    25582582    {
     
    25742598    }
    25752599   
    2576     [Column(Storage="_ResourceId", DbType="UniqueIdentifier NOT NULL")]
     2600    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ResourceId", DbType="UniqueIdentifier NOT NULL")]
    25772601    public System.Guid ResourceId
    25782602    {
     
    25982622    }
    25992623   
    2600     [Column(Storage="_StartDate", DbType="DateTime NOT NULL")]
     2624    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_StartDate", DbType="DateTime NOT NULL")]
    26012625    public System.DateTime StartDate
    26022626    {
     
    26182642    }
    26192643   
    2620     [Column(Storage="_EndDate", DbType="DateTime NOT NULL")]
     2644    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_EndDate", DbType="DateTime NOT NULL")]
    26212645    public System.DateTime EndDate
    26222646    {
     
    26382662    }
    26392663   
    2640     [Column(Storage="_AllDayEvent", DbType="Bit NOT NULL")]
     2664    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_AllDayEvent", DbType="Bit NOT NULL")]
    26412665    public bool AllDayEvent
    26422666    {
     
    26582682    }
    26592683   
    2660     [Column(Storage="_Recurring", DbType="Bit NOT NULL")]
     2684    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Recurring", DbType="Bit NOT NULL")]
    26612685    public bool Recurring
    26622686    {
     
    26782702    }
    26792703   
    2680     [Column(Storage="_RecurringId", DbType="UniqueIdentifier")]
     2704    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_RecurringId", DbType="UniqueIdentifier")]
    26812705    public System.Guid RecurringId
    26822706    {
     
    26982722    }
    26992723   
    2700     [Association(Name="Resource_UptimeCalendar", Storage="_Resource", ThisKey="ResourceId", OtherKey="ResourceId", IsForeignKey=true, DeleteRule="CASCADE")]
     2724    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Resource_UptimeCalendar", Storage="_Resource", ThisKey="ResourceId", OtherKey="ResourceId", IsForeignKey=true, DeleteRule="CASCADE")]
    27012725    public Resource Resource
    27022726    {
  • branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Server.LINQDataAccess/3.3/HiveDataContext.xml

    r3931 r4141  
    11<?xml version="1.0" encoding="utf-8"?>
    2 <Database Name="HeuristicLab.Hive.Linq.Test" Class="HiveDataContext" xmlns="http://schemas.microsoft.com/linqtosql/dbml/2007">
     2<Database Name="HeuristicLab.Hive" Class="HiveDataContext" xmlns="http://schemas.microsoft.com/linqtosql/dbml/2007">
    33  <Table Name="dbo.AssignedResources" Member="AssignedResources">
    44    <Type Name="AssignedResource">
     
    9999      <Column Name="ResourceId" Member="ResourceId" DbType="UniqueIdentifier" Type="System.Guid" CanBeNull="true"/>
    100100      <Column Name="Percentage" Member="Percentage" DbType="Float" Type="System.Double" CanBeNull="true"/>
     101      <Column Name="Exception" Member="Exception" DbType="VarChar(MAX)" Type="System.String" CanBeNull="true"/>
    101102      <Column Name="SerializedJob" Member="SerializedJob" DbType="VarBinary(MAX)" UpdateCheck="Never" Type="System.Data.Linq.Binary" IsDelayLoaded="true"/>
    102103      <Column Name="DateCreated" Member="DateCreated" DbType="DateTime" Type="System.DateTime" CanBeNull="true"/>
  • branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Server.LINQDataAccess/3.3/JobDao.cs

    r4119 r4141  
    167167
    168168      target.Percentage = source.Percentage;
     169      target.Exception = source.Exception;
    169170
    170171      target.Priority = source.Priority;
     
    193194      target.DateFinished = source.DateFinished;
    194195      target.Id = source.JobId;
    195        
     196
     197      target.Exception = source.Exception;
    196198      target.Percentage = source.Percentage;
    197199     
Note: See TracChangeset for help on using the changeset viewer.