Ignore:
Timestamp:
07/16/15 15:09:12 (6 years ago)
Author:
dglaser
Message:

#2388:

HeuristicLab.Services.Hive.DataAccess-3.3:

  • Removed old statistics tables
  • Updated SQL Scripts

HeuristicLab.Services.WebApp-3.3:
HeuristicLab.Services.WebApp.Status-3.3:
HeuristicLab.Services.WebApp.Statistics-3.3:

  • Minor changes
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HiveStatistics/sources/HeuristicLab.Services.Hive/3.3/Convert.cs

    r12584 r12768  
    323323    }
    324324    #endregion
    325 
    326     #region SlaveStatistics
    327     public static DT.SlaveStatistics ToDto(DB.SlaveStatistics source) {
    328       if (source == null) return null;
    329       return new DT.SlaveStatistics {
    330         Id = source.StatisticsId,
    331         SlaveId = source.SlaveId,
    332         Cores = source.Cores,
    333         CpuUtilization = source.CpuUtilization,
    334         FreeCores = source.FreeCores,
    335         FreeMemory = source.FreeMemory,
    336         Memory = source.Memory
    337       };
    338     }
    339     public static DB.SlaveStatistics ToEntity(DT.SlaveStatistics source) {
    340       if (source == null) return null;
    341       var entity = new DB.SlaveStatistics(); ToEntity(source, entity);
    342       return entity;
    343     }
    344     public static void ToEntity(DT.SlaveStatistics source, DB.SlaveStatistics target) {
    345       if ((source != null) && (target != null)) {
    346         target.StatisticsId = source.Id;
    347         target.SlaveId = source.SlaveId;
    348         target.Cores = source.Cores;
    349         target.CpuUtilization = source.CpuUtilization;
    350         target.FreeCores = source.FreeCores;
    351         target.FreeMemory = source.FreeMemory;
    352         target.Memory = source.Memory;
    353       }
    354     }
    355     #endregion
    356 
    357     #region Statistics
    358     public static DT.Statistics ToDto(DB.Statistics source) {
    359       if (source == null) return null;
    360       return new DT.Statistics {
    361         Id = source.StatisticsId,
    362         TimeStamp = source.Timestamp,
    363         SlaveStatistics = source.SlaveStatistics.Select(x => Convert.ToDto(x)).ToArray(),
    364         UserStatistics = source.UserStatistics.Select(x => Convert.ToDto(x)).ToArray()
    365       };
    366     }
    367     public static DB.Statistics ToEntity(DT.Statistics source) {
    368       if (source == null) return null;
    369       var entity = new DB.Statistics(); ToEntity(source, entity);
    370       return entity;
    371     }
    372     public static void ToEntity(DT.Statistics source, DB.Statistics target) {
    373       if ((source != null) && (target != null)) {
    374         target.StatisticsId = source.Id;
    375         target.Timestamp = source.TimeStamp;
    376 
    377       }
    378     }
    379     #endregion
    380 
    381     #region UserStatistics
    382     public static DT.UserStatistics ToDto(DB.UserStatistics source) {
    383       if (source == null) return null;
    384       return new DT.UserStatistics {
    385         Id = source.StatisticsId,
    386         UserId = source.UserId,
    387         UsedCores = source.UsedCores,
    388         ExecutionTime = TimeSpan.FromMilliseconds(source.ExecutionTimeMs),
    389         ExecutionTimeFinishedJobs = TimeSpan.FromMilliseconds(source.ExecutionTimeMsFinishedJobs),
    390         StartToEndTime = TimeSpan.FromMilliseconds(source.StartToEndTimeMs)
    391       };
    392     }
    393     public static DB.UserStatistics ToEntity(DT.UserStatistics source) {
    394       if (source == null) return null;
    395       var entity = new DB.UserStatistics(); ToEntity(source, entity);
    396       return entity;
    397     }
    398     public static void ToEntity(DT.UserStatistics source, DB.UserStatistics target) {
    399       if ((source != null) && (target != null)) {
    400         target.StatisticsId = source.Id;
    401         target.UserId = source.UserId;
    402         target.UsedCores = source.UsedCores;
    403         target.ExecutionTimeMs = source.ExecutionTime.TotalMilliseconds;
    404         target.ExecutionTimeMsFinishedJobs = source.ExecutionTimeFinishedJobs.TotalMilliseconds;
    405         target.StartToEndTimeMs = source.StartToEndTime.TotalMilliseconds;
    406       }
    407     }
    408     #endregion
    409 
    410325    #region TaskData
    411326    public static DT.TaskState ToDto(DB.TaskState source) {
Note: See TracChangeset for help on using the changeset viewer.