Esempio n. 1
0
     public Task <Empty> ReduceDoneAsync(ReduceOutputInfoDto request)
     {
         Console.WriteLine($"[info] {request.WorkerInfo.WorkerUuid}: Reduce done.");
         Console.WriteLine($"[info] {request.WorkerInfo.WorkerUuid}: File is:");
         Console.WriteLine($"[info] {request.FileInfo.FilePath}");
         lock (_reduceTasks)
         {
             var reduceTask = _reduceTasks.Find(xxxx => xxxx.Assignee?.WorkerUuid == request.WorkerInfo.WorkerUuid);
             if (reduceTask != null)
             {
                 reduceTask.Assignee.AssignedTask = null;
                 reduceTask.Assignee          = null;
                 reduceTask.CompletedFileInfo = new()
                 {
                     FilePath       = request.FileInfo.FilePath,
                     FileSize       = request.FileInfo.FileSize,
                     PartitionIndex = request.FileInfo.PartitionIndex
                 };
             }
             // check if all tasks are done
             if (!_reduceTasks.Exists(xxxx => !xxxx.IsTaskCompleted))
             {
                 _isAllDone = true;
             }
             return(Task.FromResult(new Empty()));
         }
     }
 }
Esempio n. 2
0
 public override Task <Empty> ReduceDone(ReduceOutputInfoDto request, ServerCallContext context)
 {
     return(_master.ReduceDoneAsync(request));
 }