Changeset 9399


Ignore:
Timestamp:
04/26/13 17:36:48 (7 years ago)
Author:
pfleck
Message:

#2030
Removed unnecessary UpdatePlugins in UpdateTask.
Optimized GetTask and GetPlugin with compiled queries.

Location:
branches/HivePerformance/sources/HeuristicLab.Services.Hive/3.3
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/HivePerformance/sources/HeuristicLab.Services.Hive/3.3/HiveDao.cs

    r9397 r9399  
    4040      select t
    4141    );
     42
     43    public Task GetTaskByDto(DT.Task taskDto) {
     44      var task = GetTaskById(taskDto.Id);
     45      DT.Convert.ToEntity(taskDto, task);
     46      return task;
     47    }
    4248
    4349    public Tuple<Task, Guid?> GetTaskByIdAndLastStateLogSlaveId(Guid taskId) {
     
    177183
    178184    #region Plugin Methods
     185    public Plugin GetPluginById(Guid pluginId) {
     186      return GetPluginByIdQuery(Db, pluginId).SingleOrDefault();
     187    }
     188
     189    private static Func<HiveDataContext, Guid, IQueryable<Plugin>> GetPluginByIdQuery = CompiledQuery.Compile((HiveDataContext db, Guid pluginId) =>
     190      from p in db.Plugins
     191      where p.PluginId == pluginId
     192      select p
     193    );
    179194
    180195    #endregion
  • branches/HivePerformance/sources/HeuristicLab.Services.Hive/3.3/HiveService.cs

    r9397 r9399  
    9191
    9292      return trans.UseTransaction(() => {
    93         return dtoDao.GetTask(taskId);
     93        return DT.Convert.ToDto(dao.GetTaskById(taskId));
    9494      }, false, false);
    9595    }
     
    159159
    160160      trans.UseTransaction(() => {
    161         dtoDao.UpdateTaskAndPlugins(taskDto);
     161        var task = dao.GetTaskByDto(taskDto);
     162        dao.UpdateTask(task);
    162163      });
    163164    }
     
    167168      author.AuthorizeForTask(task.Id, Permission.Full);
    168169
    169       // what for?
    170       /*trans.UseTransaction(() => {
    171         dtoDao.UpdateTaskAndPlugins(task);
    172       });*/
     170      trans.UseTransaction(() => {
     171        var t = dao.GetTaskByDto(task);
     172        dao.UpdateTask(t);
     173      });
    173174
    174175      trans.UseTransaction(() => {
     
    474475      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave);
    475476      return trans.UseTransaction(() => {
    476         return dtoDao.GetPlugin(pluginId);
     477        return DT.Convert.ToDto(dao.GetPluginById(pluginId));
    477478      });
    478479    }
  • branches/HivePerformance/sources/HeuristicLab.Services.Hive/3.3/Interfaces/IHiveDao.cs

    r9397 r9399  
    3030    #region Task Methods
    3131    Task GetTaskById(Guid task);
     32    Task GetTaskByDto(DT.Task taskDto);
    3233    Tuple<Task, Guid?> GetTaskByIdAndLastStateLogSlaveId(Guid taskId);
    3334
     
    3637
    3738    void UpdateTask(Task task);
    38     void UpdateTaskAndPlugins(Task task);
    3939    Task UpdateTaskState(Guid taskId, TaskState taskState, Guid? slaveId, Guid? userId, string exception);
    4040
     
    4343
    4444    #region TaskData Methods
    45     TaskData GetTaskDataByDto(DT.TaskData dto);
     45    TaskData GetTaskDataByDto(DT.TaskData taskDataDto);
    4646    void UpdateTaskData(TaskData taskData);
    4747    #endregion
     
    6060
    6161    #region Plugin Methods
    62 
     62    Plugin GetPluginById(Guid pluginId);
    6363    #endregion
    6464
Note: See TracChangeset for help on using the changeset viewer.