Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/07/12 02:07:44 (12 years ago)
Author:
ascheibe
Message:

#1744

  • added the new Hive engine. The engine can now be executed in the Hive. If child tasks are created it pauses and is transfered back to the server. If the child tasks are finished it is sent back to a slave.
  • changed the server so that it reschedules paused parent tasks if their childs are finished as well as tasks where FinishWhenChildJobsFinished is set to false
Location:
branches/HiveHiveEngine
Files:
21 added
4 edited

Legend:

Unmodified
Added
Removed
  • branches/HiveHiveEngine/HeuristicLab 3.3.sln

    r7251 r7287  
    272272EndProject
    273273Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Algorithms.Benchmarks.Views-3.3", "HeuristicLab.Algorithms.Benchmarks.Views\3.3\HeuristicLab.Algorithms.Benchmarks.Views-3.3.csproj", "{3C906172-E044-4DF0-B4FD-AA21192D5D3E}"
     274EndProject
     275Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.HiveEngine-3.3", "HeuristicLab.HiveEngine\3.3\HeuristicLab.HiveEngine-3.3.csproj", "{2C036542-5451-4A23-AFF6-87575C7BAFE7}"
     276EndProject
     277Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.HiveEngine.Views-3.3", "HeuristicLab.HiveEngine.Views\3.3\HeuristicLab.HiveEngine.Views-3.3.csproj", "{E37F15E0-D0D6-4C6E-AD22-0DA514C943A3}"
    274278EndProject
    275279Global
     
    13301334    {3C906172-E044-4DF0-B4FD-AA21192D5D3E}.Release|x86.ActiveCfg = Release|x86
    13311335    {3C906172-E044-4DF0-B4FD-AA21192D5D3E}.Release|x86.Build.0 = Release|x86
     1336    {2C036542-5451-4A23-AFF6-87575C7BAFE7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
     1337    {2C036542-5451-4A23-AFF6-87575C7BAFE7}.Debug|Any CPU.Build.0 = Debug|Any CPU
     1338    {2C036542-5451-4A23-AFF6-87575C7BAFE7}.Debug|x64.ActiveCfg = Debug|x64
     1339    {2C036542-5451-4A23-AFF6-87575C7BAFE7}.Debug|x64.Build.0 = Debug|x64
     1340    {2C036542-5451-4A23-AFF6-87575C7BAFE7}.Debug|x86.ActiveCfg = Debug|x86
     1341    {2C036542-5451-4A23-AFF6-87575C7BAFE7}.Debug|x86.Build.0 = Debug|x86
     1342    {2C036542-5451-4A23-AFF6-87575C7BAFE7}.Release|Any CPU.ActiveCfg = Release|Any CPU
     1343    {2C036542-5451-4A23-AFF6-87575C7BAFE7}.Release|Any CPU.Build.0 = Release|Any CPU
     1344    {2C036542-5451-4A23-AFF6-87575C7BAFE7}.Release|x64.ActiveCfg = Release|x64
     1345    {2C036542-5451-4A23-AFF6-87575C7BAFE7}.Release|x64.Build.0 = Release|x64
     1346    {2C036542-5451-4A23-AFF6-87575C7BAFE7}.Release|x86.ActiveCfg = Release|x86
     1347    {2C036542-5451-4A23-AFF6-87575C7BAFE7}.Release|x86.Build.0 = Release|x86
     1348    {E37F15E0-D0D6-4C6E-AD22-0DA514C943A3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
     1349    {E37F15E0-D0D6-4C6E-AD22-0DA514C943A3}.Debug|Any CPU.Build.0 = Debug|Any CPU
     1350    {E37F15E0-D0D6-4C6E-AD22-0DA514C943A3}.Debug|x64.ActiveCfg = Debug|x64
     1351    {E37F15E0-D0D6-4C6E-AD22-0DA514C943A3}.Debug|x64.Build.0 = Debug|x64
     1352    {E37F15E0-D0D6-4C6E-AD22-0DA514C943A3}.Debug|x86.ActiveCfg = Debug|x86
     1353    {E37F15E0-D0D6-4C6E-AD22-0DA514C943A3}.Debug|x86.Build.0 = Debug|x86
     1354    {E37F15E0-D0D6-4C6E-AD22-0DA514C943A3}.Release|Any CPU.ActiveCfg = Release|Any CPU
     1355    {E37F15E0-D0D6-4C6E-AD22-0DA514C943A3}.Release|Any CPU.Build.0 = Release|Any CPU
     1356    {E37F15E0-D0D6-4C6E-AD22-0DA514C943A3}.Release|x64.ActiveCfg = Release|x64
     1357    {E37F15E0-D0D6-4C6E-AD22-0DA514C943A3}.Release|x64.Build.0 = Release|x64
     1358    {E37F15E0-D0D6-4C6E-AD22-0DA514C943A3}.Release|x86.ActiveCfg = Release|x86
     1359    {E37F15E0-D0D6-4C6E-AD22-0DA514C943A3}.Release|x86.Build.0 = Release|x86
    13321360  EndGlobalSection
    13331361  GlobalSection(SolutionProperties) = preSolution
  • branches/HiveHiveEngine/HeuristicLab.Clients.Hive/3.3/HiveClient.cs

    r7285 r7287  
    2929using HeuristicLab.Common;
    3030using HeuristicLab.Core;
     31using HeuristicLab.Optimization;
    3132using HeuristicLab.PluginInfrastructure;
    3233using TS = System.Threading.Tasks;
     
    315316      finally {
    316317        refreshableJob.IsProgressing = false;
     318        refreshableJob.Progress.Finish();
    317319      }
    318320    }
     
    364366          taskData = hiveTask.GetAsTaskData(true, out plugins);
    365367        } else {
    366           hiveTask.Task.IsParentTask = false;
     368          if (hiveTask.ItemTask.Item is EngineAlgorithm && ((EngineAlgorithm)hiveTask.ItemTask.Item).Engine is IHiveEngine) {
     369            hiveTask.Task.IsParentTask = true;
     370            //TODO: this is a little hack so that this task does not get executed immediately because the taskdata will be uploaded twice
     371            hiveTask.Task.State = TaskState.Aborted;
     372          } else {
     373            hiveTask.Task.IsParentTask = false;
     374          }
     375
    367376          hiveTask.Task.FinishWhenChildJobsFinished = false;
    368377          taskData = hiveTask.GetAsTaskData(false, out plugins);
     
    389398            } else {
    390399              hiveTask.Task.Id = HiveServiceLocator.Instance.CallHiveService((s) => s.AddTask(hiveTask.Task, taskData, groups.ToList()));
     400
     401              if (hiveTask.Task.State == TaskState.Aborted) {
     402                //TODO: this is a very bad hack
     403                if (hiveTask.ItemTask.Item is EngineAlgorithm && ((EngineAlgorithm)hiveTask.ItemTask.Item).Engine is IHiveEngine) {
     404                  IHiveEngine he = ((EngineAlgorithm)hiveTask.ItemTask.Item).Engine as IHiveEngine;
     405                  he.ParentTaskId = hiveTask.Task.Id;
     406                  taskData = hiveTask.GetAsTaskData(false, out plugins);
     407                  taskData.TaskId = hiveTask.Task.Id;
     408
     409                  Task t = HiveServiceLocator.Instance.CallHiveService((s) => s.GetTask(hiveTask.Task.Id));
     410                  t.State = TaskState.Waiting;
     411                  HiveServiceLocator.Instance.CallHiveService((s) => s.UpdateTaskData(t, taskData));
     412                }
     413              }
     414
    391415            }
    392416          }
  • branches/HiveHiveEngine/HeuristicLab.Services.Hive/3.3/HiveDao.cs

    r7259 r7287  
    103103                               || child.State == TaskState.Aborted
    104104                               || child.State == TaskState.Failed).All(x => x)
     105                    orderby ar.Task.Priority descending, db.Random()
     106                    select DT.Convert.ToDto(ar.Task);
     107        return count == 0 ? query.ToArray() : query.Take(count).ToArray();
     108      }
     109    }
     110
     111    /// <summary>
     112    /// this is for the hive engine
     113    /// </summary>   
     114    private IEnumerable<DT.Task> GetPausedParentTasks(IEnumerable<Guid> resourceIds, int count) {
     115      using (var db = CreateContext()) {
     116        var query = from ar in db.AssignedResources
     117                    where resourceIds.Contains(ar.ResourceId)
     118                       && ar.Task.State == TaskState.Paused
     119                       && ar.Task.IsParentTask
     120                       && !ar.Task.FinishWhenChildJobsFinished
     121                       && (from child in db.Tasks
     122                           where child.ParentTaskId == ar.Task.TaskId
     123                           select child).All(x => x.State == TaskState.Finished)
    105124                       && (from child in db.Tasks // avoid returning WaitForChildTasks task where no child-task exist (yet)
    106125                           where child.ParentTaskId == ar.Task.TaskId
     
    115134      using (var db = CreateContext()) {
    116135        var resourceIds = GetParentResources(slave.Id).Select(r => r.Id);
    117         //Originally we checked here if there are parent tasks which should be calculated (with GetParentTasks(resourceIds, count, false);).
    118         //Because there is at the moment no case where this makes sense (there don't exist parent tasks which need to be calculated),
    119         //we skip this step because it's wasted runtime
     136
     137        //check for freshly uploaded hive engine tasks
     138        var waitingParentJobs = GetParentTasks(resourceIds, count, false);
     139        if (count > 0 && waitingParentJobs.Count() >= count) return waitingParentJobs.Take(count).ToArray();
     140
     141        //check if there are hive engine tasks which have finished childs
     142        waitingParentJobs = GetPausedParentTasks(resourceIds, count);
     143        if (count > 0 && waitingParentJobs.Count() >= count) return waitingParentJobs.Take(count).ToArray();
    120144
    121145        var query = from ar in db.AssignedResources
  • branches/HiveHiveEngine/HeuristicLab.Services.Hive/3.3/HiveService.cs

    r7259 r7287  
    7171        }
    7272        dao.AddTaskData(taskData);
    73         dao.UpdateTaskState(task.Id, DA.TaskState.Waiting, null, userManager.CurrentUserId, null);
     73        //TODO: hack!! change this
     74        if (task.State != TaskState.Aborted) {
     75          dao.UpdateTaskState(task.Id, DA.TaskState.Waiting, null, userManager.CurrentUserId, null);
     76        }
    7477        return taskData.TaskId;
    7578      }, false, true);
Note: See TracChangeset for help on using the changeset viewer.