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/HeuristicLab.Services.Hive/3.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • 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.