Free cookie consent management tool by TermsFeed Policy Generator

Changeset 12773


Ignore:
Timestamp:
07/17/15 10:11:56 (9 years ago)
Author:
dglaser
Message:

#2388:

HeuristicLab.Services.WebApp-3.3:

  • The font is now loaded properly even when accessing the page over https
  • Added no-cache to the index page
  • Added no-cache to the views in addition to the existing (datetime) cache buster
    • Caching can be enabled when required

HeuristicLab.Services.Hive-3.3:

  • Improved performance of NewHeartbeatManager by adding an additional check if the collection is empty

HeuristicLab.Services.WebApp.Statistics-3.3:

  • Removed invalid link from the exception page

Projects:

  • Added the '-3.3' affix to the assembly names
Location:
branches/HiveStatistics/sources
Files:
8 edited

Legend:

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

    r12691 r12773  
    125125    /// </summary>
    126126    private IEnumerable<MessageContainer> UpdateTasks(Heartbeat heartbeat, bool IsAllowedToCalculate) {
    127       List<MessageContainer> actions = new List<MessageContainer>();
     127      using (new PerformanceLogger("Old_UpdateTasks")) {
     128        List<MessageContainer> actions = new List<MessageContainer>();
    128129
    129       if (heartbeat.JobProgress == null)
    130         return actions;
     130        if (heartbeat.JobProgress == null)
     131          return actions;
    131132
    132       if (!IsAllowedToCalculate && heartbeat.JobProgress.Count != 0) {
    133         actions.Add(new MessageContainer(MessageContainer.MessageType.PauseAll));
    134       } else {
    135         // process the jobProgresses
    136         foreach (var jobProgress in heartbeat.JobProgress) {
    137           Tuple<Task, Guid?> taskWithLastStateLogSlaveId = null;
    138           trans.UseTransaction(() => {
    139             taskWithLastStateLogSlaveId = dao.GetTaskByIdAndLastStateLogSlaveId(jobProgress.Key);
    140           });
    141           var curTask = taskWithLastStateLogSlaveId != null ? taskWithLastStateLogSlaveId.Item1 : null;
    142           if (curTask == null) {
    143             // task does not exist in db
    144             actions.Add(new MessageContainer(MessageContainer.MessageType.AbortTask, jobProgress.Key));
    145             LogFactory.GetLogger(this.GetType().Namespace).Log("Task on slave " + heartbeat.SlaveId + " does not exist in DB: " + jobProgress.Key);
    146           } else {
    147             var slaveId = taskWithLastStateLogSlaveId.Item2;
    148             if (slaveId == Guid.Empty || slaveId != heartbeat.SlaveId) {
    149               // assigned slave does not match heartbeat
    150               actions.Add(new MessageContainer(MessageContainer.MessageType.AbortTask, curTask.TaskId));
    151               LogFactory.GetLogger(this.GetType().Namespace).Log("The slave " + heartbeat.SlaveId + " is not supposed to calculate task: " + curTask);
    152             } else if (!dao.TaskIsAllowedToBeCalculatedBySlave(curTask.TaskId, heartbeat.SlaveId)) {
    153               // assigned resources ids of task do not match with slaveId (and parent resourceGroupIds); this might happen when slave is moved to different group
    154               actions.Add(new MessageContainer(MessageContainer.MessageType.PauseTask, curTask.TaskId));
     133        if (!IsAllowedToCalculate && heartbeat.JobProgress.Count != 0) {
     134          actions.Add(new MessageContainer(MessageContainer.MessageType.PauseAll));
     135        } else {
     136          // process the jobProgresses
     137          foreach (var jobProgress in heartbeat.JobProgress) {
     138            Tuple<Task, Guid?> taskWithLastStateLogSlaveId = null;
     139            trans.UseTransaction(() => {
     140              taskWithLastStateLogSlaveId =
     141                dao.GetTaskByIdAndLastStateLogSlaveId(jobProgress.Key);
     142            });
     143            var curTask = taskWithLastStateLogSlaveId != null ? taskWithLastStateLogSlaveId.Item1 : null;
     144            if (curTask == null) {
     145              // task does not exist in db
     146              actions.Add(new MessageContainer(MessageContainer.MessageType.AbortTask, jobProgress.Key));
     147              LogFactory.GetLogger(this.GetType().Namespace)
     148                .Log("Task on slave " + heartbeat.SlaveId + " does not exist in DB: " + jobProgress.Key);
    155149            } else {
    156               // save task execution time
    157               curTask.ExecutionTimeMs = jobProgress.Value.TotalMilliseconds;
    158               curTask.LastHeartbeat = DateTime.Now;
     150              var slaveId = taskWithLastStateLogSlaveId.Item2;
     151              if (slaveId == Guid.Empty || slaveId != heartbeat.SlaveId) {
     152                // assigned slave does not match heartbeat
     153                actions.Add(new MessageContainer(MessageContainer.MessageType.AbortTask, curTask.TaskId));
     154                LogFactory.GetLogger(this.GetType().Namespace)
     155                  .Log("The slave " + heartbeat.SlaveId + " is not supposed to calculate task: " + curTask);
     156              } else if (!dao.TaskIsAllowedToBeCalculatedBySlave(curTask.TaskId, heartbeat.SlaveId)) {
     157                // assigned resources ids of task do not match with slaveId (and parent resourceGroupIds); this might happen when slave is moved to different group
     158                actions.Add(new MessageContainer(MessageContainer.MessageType.PauseTask, curTask.TaskId));
     159              } else {
     160                // save task execution time
     161                curTask.ExecutionTimeMs = jobProgress.Value.TotalMilliseconds;
     162                curTask.LastHeartbeat = DateTime.Now;
    159163
    160               switch (curTask.Command) {
    161                 case Command.Stop:
    162                   actions.Add(new MessageContainer(MessageContainer.MessageType.StopTask, curTask.TaskId));
    163                   break;
    164                 case Command.Pause:
    165                   actions.Add(new MessageContainer(MessageContainer.MessageType.PauseTask, curTask.TaskId));
    166                   break;
    167                 case Command.Abort:
    168                   actions.Add(new MessageContainer(MessageContainer.MessageType.AbortTask, curTask.TaskId));
    169                   break;
     164                switch (curTask.Command) {
     165                  case Command.Stop:
     166                    actions.Add(new MessageContainer(MessageContainer.MessageType.StopTask, curTask.TaskId));
     167                    break;
     168                  case Command.Pause:
     169                    actions.Add(new MessageContainer(MessageContainer.MessageType.PauseTask, curTask.TaskId));
     170                    break;
     171                  case Command.Abort:
     172                    actions.Add(new MessageContainer(MessageContainer.MessageType.AbortTask, curTask.TaskId));
     173                    break;
     174                }
     175                trans.UseTransaction(() => {
     176                  dao.UpdateTask(curTask);
     177                });
    170178              }
    171               trans.UseTransaction(() => {
    172                 dao.UpdateTask(curTask);
    173               });
    174179            }
    175180          }
    176181        }
     182        return actions;
    177183      }
    178       return actions;
    179184    }
    180185  }
  • branches/HiveStatistics/sources/HeuristicLab.Services.Hive/3.3/Manager/NewHeartbeatManager.cs

    r12691 r12773  
    5050        var slaveDao = pm.SlaveDao;
    5151        var taskDao = pm.TaskDao;
    52 
    5352        var slave = pm.UseTransaction(() => slaveDao.GetById(heartbeat.SlaveId));
    5453        if (slave == null) {
     
    8584              if (mutexAquired) {
    8685                var waitingTasks = pm.UseTransaction(() => taskDao.GetWaitingTasks(slave)
    87                   .Select(x => new TaskInfoForScheduler {
    88                     TaskId = x.TaskId,
    89                     JobId = x.JobId,
    90                     Priority = x.Priority
    91                   })
    92                   .ToList()
     86                    .Select(x => new TaskInfoForScheduler {
     87                      TaskId = x.TaskId,
     88                      JobId = x.JobId,
     89                      Priority = x.Priority
     90                    })
     91                    .ToList()
    9392                );
    9493                var availableTasks = TaskScheduler.Schedule(waitingTasks);
     
    146145      var assignedResourceDao = pm.AssignedResourceDao;
    147146      var actions = new List<MessageContainer>();
    148       if (heartbeat.JobProgress == null)
     147      if (heartbeat.JobProgress == null || !heartbeat.JobProgress.Any())
    149148        return actions;
    150149
     
    154153        // select all tasks and statelogs with one query
    155154        var taskIds = heartbeat.JobProgress.Select(x => x.Key).ToList();
    156         var taskInfos =
     155        var taskInfos = pm.UseTransaction(() =>
    157156          (from task in taskDao.GetAll()
    158157           where taskIds.Contains(task.TaskId)
     
    162161             Command = task.Command,
    163162             SlaveId = lastStateLog != null ? lastStateLog.SlaveId : default(Guid)
    164            })
    165            .ToList();
     163           }).ToList()
     164        );
    166165
    167166        // process the jobProgresses
  • branches/HiveStatistics/sources/HeuristicLab.Services.WebApp.Statistics/3.3/HeuristicLab.Services.WebApp.Statistics-3.3.csproj

    r12584 r12773  
    99    <AppDesignerFolder>Properties</AppDesignerFolder>
    1010    <RootNamespace>HeuristicLab.Services.WebApp.Statistics</RootNamespace>
    11     <AssemblyName>HeuristicLab.Services.WebApp.Statistics</AssemblyName>
     11    <AssemblyName>HeuristicLab.Services.WebApp.Statistics-3.3</AssemblyName>
    1212    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
    1313    <FileAlignment>512</FileAlignment>
  • branches/HiveStatistics/sources/HeuristicLab.Services.WebApp.Statistics/3.3/WebApp/exceptions/exceptions.cshtml

    r12560 r12773  
    4545                            <td>{{($index + 1)+((curExceptionsPage-1)*(exceptionsPageSize))}}</td>
    4646                            <td><a ng-href="#/statistics/jobs/{{exception.JobId}}">{{exception.JobName}}</a></td>
    47                             <td><a ng-href="#/statistics/tasks/{{exception.TaskId}}">{{exception.TaskId}}</a></td>
     47                            <td>{{exception.TaskId}}</td>
    4848                            <td><a ng-href="#/statistics/users/{{exception.UserId}}">{{exception.UserName}}</a></td>
    4949                            <td><a ng-href="#/statistics/clients/{{exception.ClientId}}">{{exception.ClientName}}</a></td>
  • branches/HiveStatistics/sources/HeuristicLab.Services.WebApp.Status/3.3/HeuristicLab.Services.WebApp.Status-3.3.csproj

    r12558 r12773  
    99    <AppDesignerFolder>Properties</AppDesignerFolder>
    1010    <RootNamespace>HeuristicLab.Services.WebApp.Status</RootNamespace>
    11     <AssemblyName>HeuristicLab.Services.WebApp.Status</AssemblyName>
     11    <AssemblyName>HeuristicLab.Services.WebApp.Status-3.3</AssemblyName>
    1212    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
    1313    <FileAlignment>512</FileAlignment>
  • branches/HiveStatistics/sources/HeuristicLab.Services.WebApp/3.3/Controllers/AppController.cs

    r12558 r12773  
    2020#endregion
    2121
     22using System.Web;
    2223using System.Web.Mvc;
    2324
     
    3031        return RedirectPermanent(Request.Url + "/");
    3132      }
     33      Response.Cache.SetCacheability(HttpCacheability.NoCache);
    3234      return View("~/WebApp/shared/layout/layout.cshtml");
    3335    }
     
    3840
    3941    public ActionResult LoadSharedView(string directory, string view, string dateTime) {
    40       // dateTime is optional to avoid browser caching
     42      Response.Cache.SetCacheability(HttpCacheability.NoCache);
     43      // dateTime is optional to definitly avoid browser caching
    4144      return View(string.Format("~/WebApp/shared/{0}/{1}", directory, view));
    4245    }
    4346
    4447    public ActionResult LoadPluginView(string plugin, string view, string dateTime) {
    45       // dateTime is optional to avoid browser caching
     48      Response.Cache.SetCacheability(HttpCacheability.NoCache);
     49      // dateTime is optional to definitly avoid browser caching
    4650      return View(string.Format("~/WebApp/plugins/{0}/{1}", plugin, view));
    4751    }
  • branches/HiveStatistics/sources/HeuristicLab.Services.WebApp/3.3/HeuristicLab.Services.WebApp-3.3.csproj

    r12584 r12773  
    1313    <AppDesignerFolder>Properties</AppDesignerFolder>
    1414    <RootNamespace>HeuristicLab.Services.WebApp</RootNamespace>
    15     <AssemblyName>HeuristicLab.Services.WebApp</AssemblyName>
     15    <AssemblyName>HeuristicLab.Services.WebApp-3.3</AssemblyName>
    1616    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
    1717    <MvcBuildViews>false</MvcBuildViews>
  • branches/HiveStatistics/sources/HeuristicLab.Services.WebApp/3.3/WebApp/shared/layout/layout.cshtml

    r12551 r12773  
    2424    <meta charset="utf-8" />
    2525    <meta name="viewport" content="width=device-width, initial-scale=1">
     26    <meta http-equiv="pragma" content="no-cache" />
    2627    <title>HeuristicLab Hive</title>
    2728    <link href="~/WebApp/HeuristicLab.ico" rel="shortcut icon" type="image/x-icon" />
    2829    @Styles.Render("~/Bundles/Vendors/css")
    2930    @Styles.Render("~/Bundles/WebApp/css")
    30     <link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700">
     31    <link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Open+Sans:300,400,600,700">
    3132    <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
    3233    <!--[if lt IE 9]>
     
    6364                <div class="navbar-content">
    6465                    <ul class="nav navbar-nav navbar-right">
    65                         @if (Request.IsAuthenticated)
    66                         {
     66                        @if (Request.IsAuthenticated) {
    6767                            <li>
    6868                                <span class="navbar-text">Hello @User.Identity.Name!</span>
     
    7171                                <a ng-href="#" data-ng-click="logout()">Logout</a>
    7272                            </li>
    73                         }
    74                         else
    75                         {
     73                        } else {
    7674                            <li>
    7775                                <a ng-href="#/login" data-ng-click="hideMenu()">Login</a>
Note: See TracChangeset for help on using the changeset viewer.