Changeset 12776


Ignore:
Timestamp:
07/17/15 16:57:22 (4 years ago)
Author:
dglaser
Message:

#2388:

HeuristicLab.Services.Hive-3.3:

  • HiveStatisticsGenerator.cs: Jobs that are deleted are now automatically marked as completed in the hive statistics tables. This was added because when a job got paused and deleted afterwards, it would still show up as ongoing job in the hive statistics.
  • Minor changes in NewHiveService.cs

HeuristicLab.Services.WebApp.Statistics-3.3:

  • Expired slaves are now shown as offline (previously the last known state was shown)
  • Adjusted dialog height

HeuristicLab.Services.WebApp-3.3:

  • Changed string.Format to Path.Combine to concate directory paths
Location:
branches/HiveStatistics/sources
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • branches/HiveStatistics/sources/HeuristicLab 3.3 Services.sln

    r12761 r12776  
    260260    {3F22B7DA-FDDB-48F0-8BB7-0ABA5120FC87}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
    261261    {3F22B7DA-FDDB-48F0-8BB7-0ABA5120FC87}.Debug|Any CPU.Build.0 = Debug|Any CPU
    262     {3F22B7DA-FDDB-48F0-8BB7-0ABA5120FC87}.Debug|x64.ActiveCfg = Debug|Any CPU
    263     {3F22B7DA-FDDB-48F0-8BB7-0ABA5120FC87}.Debug|x86.ActiveCfg = Debug|Any CPU
     262    {3F22B7DA-FDDB-48F0-8BB7-0ABA5120FC87}.Debug|x64.ActiveCfg = Debug|x64
     263    {3F22B7DA-FDDB-48F0-8BB7-0ABA5120FC87}.Debug|x64.Build.0 = Debug|x64
     264    {3F22B7DA-FDDB-48F0-8BB7-0ABA5120FC87}.Debug|x86.ActiveCfg = Debug|x86
     265    {3F22B7DA-FDDB-48F0-8BB7-0ABA5120FC87}.Debug|x86.Build.0 = Debug|x86
    264266    {3F22B7DA-FDDB-48F0-8BB7-0ABA5120FC87}.Release|Any CPU.ActiveCfg = Release|Any CPU
    265267    {3F22B7DA-FDDB-48F0-8BB7-0ABA5120FC87}.Release|Any CPU.Build.0 = Release|Any CPU
  • branches/HiveStatistics/sources/HeuristicLab.Services.Hive/3.3/HiveStatisticsGenerator.cs

    r12765 r12776  
    134134
    135135    private void UpdateExistingDimJobs(PersistenceManager pm) {
     136      var jobDao = pm.JobDao;
    136137      var dimJobDao = pm.DimJobDao;
    137138      var factTaskDao = pm.FactTaskDao;
     
    151152        }
    152153        if (totalTasks == completedTasks) {
    153           dimJob.DateCompleted = factTaskDao.GetLastCompletedTaskFromJob(dimJob.JobId) ?? DateTime.Now;
     154          var completeDate = factTaskDao.GetLastCompletedTaskFromJob(dimJob.JobId);
     155          if (completeDate == null) {
     156            if (jobDao.GetById(dimJob.JobId) == null) {
     157              completeDate = DateTime.Now;
     158            }
     159          }
     160          dimJob.DateCompleted = completeDate;
    154161        }
    155162        dimJob.TotalTasks = totalTasks;
  • branches/HiveStatistics/sources/HeuristicLab.Services.Hive/3.3/NewHiveService.cs

    r12768 r12776  
    128128    }
    129129
    130     public IEnumerable<Task> GetTasks() {
     130    public IEnumerable<DT.Task> GetTasks() {
    131131      // unused
    132132      throw new NotImplementedException();
    133133    }
    134134
    135     public IEnumerable<LightweightTask> GetLightweightTasks(IEnumerable<Guid> taskIds) {
     135    public IEnumerable<DT.LightweightTask> GetLightweightTasks(IEnumerable<Guid> taskIds) {
    136136      // unused
    137137      throw new NotImplementedException();
    138138    }
    139139
    140     public IEnumerable<LightweightTask> GetLightweightChildTasks(Guid? parentTaskId, bool recursive, bool includeParent) {
     140    public IEnumerable<DT.LightweightTask> GetLightweightChildTasks(Guid? parentTaskId, bool recursive, bool includeParent) {
    141141      // unused
    142142      throw new NotImplementedException();
     
    398398    }
    399399
    400     public IEnumerable<Job> GetAllJobs() {
     400    public IEnumerable<DT.Job> GetAllJobs() {
    401401      // unused
    402402      throw new NotImplementedException();
    403403    }
    404404
    405     public Guid AddJob(Job jobDto) {
     405    public Guid AddJob(DT.Job jobDto) {
    406406      RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
    407407      using (var pm = PersistenceManager)
    408408      using (new PerformanceLogger("AddJob")) {
    409409        var jobDao = pm.JobDao;
     410        var userPriorityDao = pm.UserPriorityDao;
    410411        return pm.UseTransaction(() => {
    411412          jobDto.OwnerUserId = UserManager.CurrentUserId;
    412413          jobDto.DateCreated = DateTime.Now;
    413414          var job = jobDao.Save(jobDto.ToEntity());
     415          if (userPriorityDao.GetById(jobDto.OwnerUserId) == null) {
     416            userPriorityDao.Save(new DA.UserPriority {
     417              UserId = jobDto.OwnerUserId,
     418              DateEnqueued = jobDto.DateCreated
     419            });
     420          }
    414421          pm.SubmitChanges();
    415422          return job.JobId;
     
    447454        var jobDao = pm.JobDao;
    448455        pm.UseTransaction(() => {
     456          // child task will be deleted by db-trigger
    449457          jobDao.Delete(jobId);
    450458          pm.SubmitChanges();
     
    546554
    547555    #region Heartbeat Methods
    548     public List<MessageContainer> Heartbeat(Heartbeat heartbeat) {
     556    public List<MessageContainer> Heartbeat(DT.Heartbeat heartbeat) {
    549557      RoleVerifier.AuthenticateForAnyRole(HiveRoles.Slave);
    550558      List<MessageContainer> result = new List<MessageContainer>();
     
    565573
    566574    #region Plugin Methods
    567     public Plugin GetPlugin(Guid pluginId) {
     575    public DT.Plugin GetPlugin(Guid pluginId) {
    568576      RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave);
    569577      using (var pm = PersistenceManager)
     
    574582    }
    575583
    576     public Plugin GetPluginByHash(byte[] hash) {
     584    public DT.Plugin GetPluginByHash(byte[] hash) {
    577585      // unused
    578586      throw new NotImplementedException();
    579587    }
    580588
    581     public Guid AddPlugin(Plugin plugin, List<PluginData> pluginData) {
     589    public Guid AddPlugin(DT.Plugin plugin, List<DT.PluginData> pluginData) {
    582590      RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
    583591      using (var pm = PersistenceManager)
     
    593601          pluginEntity = plugin.ToEntity();
    594602          foreach (var data in pluginData) {
    595             data.PluginId = default(Guid);
     603            data.PluginId = default(Guid); // real id will be assigned from linq2sql
    596604            pluginEntity.PluginData.Add(data.ToEntity());
    597605          }
     
    603611    }
    604612
    605     public IEnumerable<Plugin> GetPlugins() {
     613    public IEnumerable<DT.Plugin> GetPlugins() {
    606614      RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave);
    607615      using (var pm = PersistenceManager)
     
    616624    }
    617625
    618     public IEnumerable<PluginData> GetPluginDatas(List<Guid> pluginIds) {
     626    public IEnumerable<DT.PluginData> GetPluginDatas(List<Guid> pluginIds) {
    619627      RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave);
    620628      using (var pm = PersistenceManager)
     
    668676    }
    669677
    670     public IEnumerable<ResourcePermission> GetResourcePermissions(Guid resourceId) {
     678    public IEnumerable<DT.ResourcePermission> GetResourcePermissions(Guid resourceId) {
    671679      RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
    672680      using (var pm = PersistenceManager)
     
    682690
    683691    #region Resource Methods
    684     public IEnumerable<Resource> GetChildResources(Guid resourceId) {
     692    public IEnumerable<DT.Resource> GetChildResources(Guid resourceId) {
    685693      // unused
    686694      throw new NotImplementedException();
     
    718726    }
    719727
    720     public Slave GetSlave(Guid slaveId) {
     728    public DT.Slave GetSlave(Guid slaveId) {
    721729      RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator);
    722730      using (var pm = PersistenceManager)
     
    727735    }
    728736
    729     public SlaveGroup GetSlaveGroup(Guid slaveGroupId) {
     737    public DT.SlaveGroup GetSlaveGroup(Guid slaveGroupId) {
    730738      // unused
    731739      throw new NotImplementedException();
    732740    }
    733741
    734     public IEnumerable<Slave> GetSlaves() {
     742    public IEnumerable<DT.Slave> GetSlaves() {
    735743      RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
    736744      bool isAdministrator = RoleVerifier.IsInRole(HiveRoles.Administrator);
     
    757765    }
    758766
    759     public IEnumerable<SlaveGroup> GetSlaveGroups() {
     767    public IEnumerable<DT.SlaveGroup> GetSlaveGroups() {
    760768      RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
    761769      bool isAdministrator = RoleVerifier.IsInRole(HiveRoles.Administrator);
     
    878886    }
    879887
    880     public IEnumerable<Task> GetTasksByResourceId(Guid resourceId) {
     888    public IEnumerable<DT.Task> GetTasksByResourceId(Guid resourceId) {
    881889      // unused
    882890      throw new NotImplementedException();
     
    967975    }
    968976
    969     public IEnumerable<Downtime> GetDowntimesForResource(Guid resourceId) {
     977    public IEnumerable<DT.Downtime> GetDowntimesForResource(Guid resourceId) {
    970978      RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
    971979      using (var pm = PersistenceManager)
     
    9951003
    9961004    #region UserPriorities Methods
    997     public IEnumerable<UserPriority> GetUserPriorities() {
     1005    public IEnumerable<DT.UserPriority> GetUserPriorities() {
    9981006      using (var pm = PersistenceManager)
    9991007      using (new PerformanceLogger("GetUserPriorities")) {
  • branches/HiveStatistics/sources/HeuristicLab.Services.WebApp.Statistics/3.3/Properties/AssemblyInfo.cs.frame

    r12477 r12776  
    2727// set of attributes. Change these attribute values to modify the information
    2828// associated with an assembly.
    29 [assembly: AssemblyTitle("HeuristicLab.Services.WebApp")]
    30 [assembly: AssemblyDescription("HeuristicLab Services Application Container")]
     29[assembly: AssemblyTitle("HeuristicLab.Services.WebApp.Statistics")]
     30[assembly: AssemblyDescription("HeuristicLab WebApp Statistics plugin")]
    3131[assembly: AssemblyConfiguration("")]
    3232[assembly: AssemblyCompany("")]
  • branches/HiveStatistics/sources/HeuristicLab.Services.WebApp.Statistics/3.3/WebApi/ClientController.cs

    r12584 r12776  
    8383                    UsedMemory = offline ? 0 : clientInfo.UsedMemory,
    8484                    CpuUtilization = offline ? 0 : clientInfo.CpuUtilization,
    85                     State = clientInfo.SlaveState.ToString(),
     85                    State = offline ? SlaveState.Offline.ToString() : clientInfo.SlaveState.ToString(),
    8686                    LastUpdate = clientInfo.Time,
    8787                    GroupId = client.ResourceGroupId,
     
    132132                         UsedMemory = offline ? 0 : clientInfo.UsedMemory,
    133133                         CpuUtilization = offline ? 0 : clientInfo.CpuUtilization,
    134                          State = clientInfo.SlaveState.ToString(),
     134                         State = offline ? SlaveState.Offline.ToString() : clientInfo.SlaveState.ToString(),
    135135                         GroupId = client.ResourceGroupId,
    136136                         GroupName = client.GroupName,
     
    218218                         UsedMemory = offline ? 0 : clientInfo.UsedMemory,
    219219                         CpuUtilization = offline ? 0 : clientInfo.CpuUtilization,
    220                          State = clientInfo.SlaveState.ToString(),
     220                         State = offline ? SlaveState.Offline.ToString() : clientInfo.SlaveState.ToString(),
    221221                         GroupId = client.ResourceGroupId,
    222222                         GroupName = client.GroupName,
  • branches/HiveStatistics/sources/HeuristicLab.Services.WebApp.Statistics/3.3/WebApp/clients/details/clientTaskDetailsDialog.cshtml

    r12768 r12776  
    55    <h4 class="modal-title">Task #{{taskNo}} - {{task.Id}}</h4>
    66</div>
    7 <div class="modal-body" style="height: 430px">
     7<div class="modal-body" style="height: 440px">
    88    <tabset>
    99        <tab heading="Details">
    10             <div style="height: 330px" class="center-block">
     10            <div style="height: 340px" class="center-block">
    1111                <div class="row" style="padding-top: 30px">
    1212                    <div class="col-md-6">
  • branches/HiveStatistics/sources/HeuristicLab.Services.WebApp.Statistics/3.3/WebApp/jobs/details/jobTaskDetailsDialog.cshtml

    r12768 r12776  
    33    <h4 class="modal-title">Task #{{taskNo}} - {{task.Id}}</h4>
    44</div>
    5 <div class="modal-body" style="height: 430px">
     5<div class="modal-body" style="height: 440px">
    66    <tabset>
    77        <tab heading="Details">
    8             <div style="height: 330px" class="center-block">
     8            <div style="height: 340px" class="center-block">
    99                <div class="row" style="padding-top: 30px">
    1010                    <div class="col-md-12">
  • branches/HiveStatistics/sources/HeuristicLab.Services.WebApp/3.3/Configs/BundleConfig.cs

    r12584 r12776  
    106106      PluginManager pluginManager = PluginManager.Instance;
    107107      foreach (var plugin in pluginManager.Plugins) {
    108         if (File.Exists(string.Format(@"{0}\{1}\{1}.js", PluginManager.PluginsDirectory, plugin.Name))) {
     108        var path = Path.Combine(PluginManager.PluginsDirectory, plugin.Name, string.Concat(plugin.Name, ".js"));
     109        if (File.Exists(path)) {
    109110          jsFiles.Add(string.Format("WebApp/plugins/{0}/{0}.js", plugin.Name));
    110111        }
  • branches/HiveStatistics/sources/HeuristicLab.Services.WebApp/3.3/PluginManager.cs

    r12765 r12776  
    4343
    4444    public static string PluginsDirectory {
    45       get { return string.Format(@"{0}WebApp\plugins", HttpRuntime.AppDomainAppPath); }
     45      get {
     46        return Path.Combine(HttpRuntime.AppDomainAppPath, "WebApp", "plugins");
     47      }
    4648    }
    4749
     
    9496      Plugin plugin = LookupPlugin(name);
    9597      if (plugin == null) {
    96         string directory = string.Format(@"{0}\{1}", PluginsDirectory, name);
     98        string directory = Path.Combine(PluginsDirectory, name);
    9799        if (Directory.Exists(directory)) {
    98100          plugin = new Plugin(name, directory, Configuration);
Note: See TracChangeset for help on using the changeset viewer.