Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/14/10 16:52:55 (13 years ago)
Author:
cneumuel
Message:

#1233

  • made MockJob to execute asynchronously with the option to spinWait
  • added methods to IHiveService
  • implemented methods for Slave handling in HiveService
  • added more tests for server
  • changed db-schema of slaves and slavegroups
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/Convert.cs

    r4905 r5106  
    4242        ParentJobId = source.ParentJobId,
    4343        Priority = source.Priority,
    44         ProjectId = source.ProjectId,
    4544        SlaveId = source.SlaveId,
    4645        JobState = source.JobState,
     
    6665        target.ParentJobId = source.ParentJobId;
    6766        target.Priority = source.Priority;
    68         target.ProjectId = source.ProjectId;
    6967        target.SlaveId = source.SlaveId;
    7068        target.JobState = source.JobState;
    7169        target.UserId = source.UserId;
    72 //        target.RequiredPlugins = db.Plugins.Select(x => source.PluginsNeededIds.Contains(x.PluginId)); - this is difficult
     70        //        target.RequiredPlugins = db.Plugins.Select(x => source.PluginsNeededIds.Contains(x.PluginId)); - this is difficult
    7371      }
    7472    }
     
    7876    public static DT.JobData ToDto(JobData source) {
    7977      if (source == null) return null;
    80       return new DT.JobData { JobId = source.JobId, Data = source.Data.ToArray() };
     78      return new DT.JobData { JobId = source.JobId, Data = source.Data.ToArray(), LastUpdate = source.LastUpdate };
    8179    }
    8280    public static JobData ToEntity(DT.JobData source) {
     
    8785    public static void ToEntity(DT.JobData source, JobData target) {
    8886      if ((source != null) && (target != null)) {
    89         target.JobId = source.JobId; target.Data = new Binary(source.Data);
     87        target.JobId = source.JobId; target.Data = new Binary(source.Data); target.LastUpdate = source.LastUpdate;
    9088      }
    9189    }
     
    9593    public static DT.HiveExperiment ToDto(HiveExperiment source) {
    9694      if (source == null) return null;
    97       return new DT.HiveExperiment { Id = source.HiveExperimentId, Description = source.Description, Name = source.Name, RootJobId = source.RootJobId, UserId = source.UserId };
     95      return new DT.HiveExperiment { Id = source.HiveExperimentId, Description = source.Description, Name = source.Name, RootJobId = source.RootJobId, UserId = source.UserId, DateCreated = source.DateCreated };
    9896    }
    9997    public static HiveExperiment ToEntity(DT.HiveExperiment source) {
     
    104102    public static void ToEntity(DT.HiveExperiment source, HiveExperiment target) {
    105103      if ((source != null) && (target != null)) {
    106         target.HiveExperimentId = source.Id; target.Description = source.Description; target.Name = source.Name; target.RootJobId = source.RootJobId; target.UserId = source.UserId;
     104        target.HiveExperimentId = source.Id; target.Description = source.Description; target.Name = source.Name; target.RootJobId = source.RootJobId; target.UserId = source.UserId; target.DateCreated = source.DateCreated;
    107105      }
    108106    }
     
    146144    public static DT.Slave ToDto(Slave source) {
    147145      if (source == null) return null;
    148       return new DT.Slave { Id = source.ResourceId, CalendarSyncState = source.CalendarSyncState, Cores = source.Cores, CpuSpeed = source.CpuSpeed, FreeCores = source.FreeCores, FreeMemory = source.FreeMemory, IsAllowedToCalculate = source.IsAllowedToCalculate, Memory = source.Memory, Name = source.Name, SlaveConfigId = source.SlaveConfigId, SlaveState = source.SlaveState };
     146      return new DT.Slave { Id = source.ResourceId, ParentResourceId = source.ParentResourceId, Cores = source.Cores, CpuSpeed = source.CpuSpeed, FreeCores = source.FreeCores, FreeMemory = source.FreeMemory, IsAllowedToCalculate = source.IsAllowedToCalculate, Memory = source.Memory, Name = source.Name, SlaveState = source.SlaveState };
    149147    }
    150148    public static Slave ToEntity(DT.Slave source) {
     
    155153    public static void ToEntity(DT.Slave source, Slave target) {
    156154      if ((source != null) && (target != null)) {
    157         target.ResourceId = source.Id; target.CalendarSyncState = source.CalendarSyncState; target.Cores = source.Cores; target.CpuSpeed = source.CpuSpeed; target.FreeCores = source.FreeCores; target.FreeMemory = source.FreeMemory; target.IsAllowedToCalculate = source.IsAllowedToCalculate; target.Memory = source.Memory; target.Name = source.Name; target.SlaveConfigId = source.SlaveConfigId; target.SlaveState = source.SlaveState;
     155        target.ResourceId = source.Id; target.ParentResourceId = source.ParentResourceId; target.Cores = source.Cores; target.CpuSpeed = source.CpuSpeed; target.FreeCores = source.FreeCores; target.FreeMemory = source.FreeMemory; target.IsAllowedToCalculate = source.IsAllowedToCalculate; target.Memory = source.Memory; target.Name = source.Name; target.SlaveState = source.SlaveState;
    158156      }
    159157    }
     
    163161    public static DT.SlaveGroup ToDto(SlaveGroup source) {
    164162      if (source == null) return null;
    165       return new DT.SlaveGroup { Id = source.ResourceId, Name = source.Name, ChildResourcesIds = source.SlaveGroup_Resources_Children.Select(x => x.ResourceId).ToList(), ParentResourcesIds = source.SlaveGroup_Resources_Parents.Select(x => x.ResourceId).ToList() };
     163      return new DT.SlaveGroup { Id = source.ResourceId, Name = source.Name, ParentResourceId = source.ParentResourceId };
    166164    }
    167165    public static SlaveGroup ToEntity(DT.SlaveGroup source) {
     
    172170    public static void ToEntity(DT.SlaveGroup source, SlaveGroup target) {
    173171      if ((source != null) && (target != null)) {
    174         target.ResourceId = source.Id;
    175         target.Name = source.Name;
    176         //target.SlaveGroup_Resources_Children = // TODO: see how working with groups will work, then decide how to handle enumerations in here
    177         //target.SlaveGroup_Resources_Parents =
     172        target.ResourceId = source.Id; target.Name = source.Name; target.ParentResourceId = source.ParentResourceId;
    178173      }
    179174    }
     
    183178    public static DT.Resource ToDto(Resource source) {
    184179      if (source == null) return null;
    185       return new DT.Resource { Id = source.ResourceId, Name = source.Name };
     180      return new DT.Resource { Id = source.ResourceId, Name = source.Name, ParentResourceId = source.ParentResourceId };
    186181    }
    187182    public static Resource ToEntity(DT.Resource source) {
     
    192187    public static void ToEntity(DT.Resource source, Resource target) {
    193188      if ((source != null) && (target != null)) {
    194         target.ResourceId = source.Id; target.Name = source.Name;
     189        target.ResourceId = source.Id; target.Name = source.Name; target.ParentResourceId = source.ParentResourceId;
    195190      }
    196191    }
Note: See TracChangeset for help on using the changeset viewer.