Beispiel #1
0
        private object GetTaskProgress(MapReduceOperation operation)
        {
            String taskId = (String)operation.TaskID;

            if (waitingTasks.ContainsKey(taskId))
            {
                return(new Runtime.MapReduce.TaskStatus(Runtime.MapReduce.TaskStatus.Status.Waiting));
            }
            else if (taskOutputStore.TaskOutputExists(taskId))
            {
                return(new Runtime.MapReduce.TaskStatus(Runtime.MapReduce.TaskStatus.Status.Completed));
            }
            if (runningTasks.ContainsKey(taskId))
            {
                Task          t   = (Task)runningTasks[taskId];
                MapReduceTask mrt = (MapReduceTask)t;
                return(mrt.TaskStatus);
            }
            else
            {
                if (this.cancelledTask.Contains(taskId))
                {
                    throw new OperationFailedException("Task with specified task ID was Cancelled.");
                }
                else
                {
                    throw new OperationFailedException("Task with specified task ID does not exist.");
                }
            }
        }
Beispiel #2
0
 public MapperTask(IMapper mapper, MapReduceInput input, IKeyFilter filter, MapReduceTask prnt)
 {
     this.mapper        = mapper;
     this.parent        = prnt;
     this.inputProvider = input;
     this.keyFilter     = filter;
 }
Beispiel #3
0
        private object SubmitMapReduceTask(MapReduceOperation operation)
        {
            try
            {
                _context.NCacheLog.CriticalInfo("MapReduce.TaskTracker ",
                                                "MapReduce task with taskId '" + operation.TaskID + "' is submitted");

                CacheBase p = (CacheBase)((_context.CacheImpl != null && _context.CacheImpl is CacheBase) ? _context.CacheImpl : null);

                Runtime.MapReduce.MapReduceTask userTask = (Runtime.MapReduce.MapReduceTask)operation.Data;
                Filter filter = operation.Filter;

                if (userTask != null)
                {
                    MapReduceTask serverTask = new MapReduceTask(p, Callback, userTask.Mapper,
                                                                 userTask.Combiner, userTask.Reducer,
                                                                 userTask.InputProvider == null ? new InputProviders.CacheInputProvider(p.InternalCache, filter != null ? filter.QueryFilter : null, this._context) : userTask.InputProvider,
                                                                 new InMemoryOutpuProvider(taskOutputStore),
                                                                 filter,
                                                                 _context, this.ChunkSize, this.MaxExceptions);
                    serverTask.TaskId = operation.TaskID;
                    serverTask.AddTaskCallbackInfo(operation.CallbackInfo);
                    return(this.SubmitTask(serverTask));
                }
            }
            catch (Exception ex)
            {
                throw new OperationFailedException(ex.Message);
            }
            return(null);
        }
Beispiel #4
0
        private Object ReducerFailed(MapReduceOperation operation)
        {
            string taskID = (string)operation.TaskID;

            if (runningTasks.ContainsKey(taskID))
            {
                MapReduceTask t = (MapReduceTask)runningTasks[taskID];
                t.ReducerFailed(operation);
            }
            return(true);
        }
Beispiel #5
0
        public ReducerTask(IReducerFactory reducer, MapReduceTask p)
        {
            this.reducerFactory = reducer;
            this.reducers       = new HashVector();
            this.parent         = p;

            //initializing and synchronizing the queue
            this.reducerInputQueue = new Queue();
            Queue synchronizedQueue = Queue.Synchronized(reducerInputQueue);

            this.reducerInputQueue = synchronizedQueue;
        }
Beispiel #6
0
 private object ReducerCompleted(MapReduceOperation operation)
 {
     lock (_lock) {
         string taskID = (string)operation.TaskID;
         if (runningTasks.ContainsKey(taskID))
         {
             MapReduceTask t = (MapReduceTask)runningTasks[taskID];
             t.ReducerCompleted(operation);
         }
         return(true);
     }
 }
Beispiel #7
0
        public CombinerTask(ICombinerFactory combiner, MapReduceTask p)
        {
            this.combinerFactory = combiner;
            this.parent          = p;
            combiners            = new HashVector();

            // initializing and synchronizing the queue
            this.combinerInputQueue = new Queue();
            Queue synchQueue = Queue.Synchronized(combinerInputQueue);

            this.combinerInputQueue = synchQueue;
        }
Beispiel #8
0
        private object RecievedReducerData(MapReduceOperation operation)
        {
            string taskID = (string)operation.TaskID;

            if (runningTasks.ContainsKey(taskID))
            {
                MapReduceTask t = (MapReduceTask)runningTasks[taskID];
                t.EnqueueReducerInput((Common.MapReduce.TaskOutputPair)operation.Data);
            }
            else
            {
                if (_context.NCacheLog.IsInfoEnabled)
                {
                    _context.NCacheLog.Info("TaskTracker.recievedReducerData", "task does not exist in running tasks " + taskID);
                }
            }
            return(true);
        }
Beispiel #9
0
 public MapReduceThrottlingManager(int chunkSize, MapReduceTask tt)
 {
     this.chunkSize = chunkSize;
     this.t         = tt;
 }