예제 #1
0
 public virtual void Handle(ContainerAllocatorEvent @event)
 {
     if (@event.GetType() == ContainerAllocator.EventType.ContainerReq)
     {
         Log.Info("Processing the event " + @event.ToString());
         // Assign the same container ID as the AM
         ContainerId cID = ContainerId.NewContainerId(GetContext().GetApplicationAttemptId
                                                          (), this.containerId.GetContainerId());
         Container container = recordFactory.NewRecordInstance <Container>();
         container.SetId(cID);
         NodeId nodeId = NodeId.NewInstance(this.nmHost, this.nmPort);
         container.SetNodeId(nodeId);
         container.SetContainerToken(null);
         container.SetNodeHttpAddress(this.nmHost + ":" + this.nmHttpPort);
         // send the container-assigned event to task attempt
         if (@event.GetAttemptID().GetTaskId().GetTaskType() == TaskType.Map)
         {
             JobCounterUpdateEvent jce = new JobCounterUpdateEvent(@event.GetAttemptID().GetTaskId
                                                                       ().GetJobId());
             // TODO Setting OTHER_LOCAL_MAP for now.
             jce.AddCounterUpdate(JobCounter.OtherLocalMaps, 1);
             eventHandler.Handle(jce);
         }
         eventHandler.Handle(new TaskAttemptContainerAssignedEvent(@event.GetAttemptID(),
                                                                   container, applicationACLs));
     }
 }
예제 #2
0
 public virtual void Handle(ContainerAllocatorEvent @event)
 {
     try
     {
         this.eventQueue.Put(@event);
     }
     catch (Exception e)
     {
         throw new YarnRuntimeException(e);
     }
 }
예제 #3
0
            public virtual void Handle(ContainerAllocatorEvent @event)
            {
                ContainerId cId = ContainerId.NewContainerId(this._enclosing.GetContext().GetApplicationAttemptId
                                                                 (), this.containerCount++);
                NodeId   nodeId   = NodeId.NewInstance(MRApp.NmHost, MRApp.NmPort);
                Resource resource = Resource.NewInstance(1234, 2);
                ContainerTokenIdentifier containerTokenIdentifier = new ContainerTokenIdentifier(
                    cId, nodeId.ToString(), "user", resource, Runtime.CurrentTimeMillis() + 10000, 42
                    , 42, Priority.NewInstance(0), 0);
                Token containerToken = MRApp.NewContainerToken(nodeId, Sharpen.Runtime.GetBytesForString
                                                                   ("password"), containerTokenIdentifier);
                Container container = Container.NewInstance(cId, nodeId, MRApp.NmHost + ":" + MRApp
                                                            .NmHttpPort, resource, null, containerToken);
                JobID id    = TypeConverter.FromYarn(MRApp.applicationId);
                JobId jobId = TypeConverter.ToYarn(id);

                this._enclosing.GetContext().GetEventHandler().Handle(new JobHistoryEvent(jobId,
                                                                                          new NormalizedResourceEvent(TaskType.Reduce, 100)));
                this._enclosing.GetContext().GetEventHandler().Handle(new JobHistoryEvent(jobId,
                                                                                          new NormalizedResourceEvent(TaskType.Map, 100)));
                this._enclosing.GetContext().GetEventHandler().Handle(new TaskAttemptContainerAssignedEvent
                                                                          (@event.GetAttemptID(), container, null));
            }
예제 #4
0
                    public void Run()
                    {
                        ContainerAllocatorEvent @event = null;

                        while (!Sharpen.Thread.CurrentThread().IsInterrupted())
                        {
                            try
                            {
                                if (this._enclosing._enclosing.concurrentRunningTasks < this._enclosing._enclosing
                                    .maxConcurrentRunningTasks)
                                {
                                    @event = this._enclosing.eventQueue.Take();
                                    ContainerId cId = ContainerId.NewContainerId(this._enclosing._enclosing.GetContext
                                                                                     ().GetApplicationAttemptId(), this._enclosing.containerCount++);
                                    Container container = MRAppBenchmark.recordFactory.NewRecordInstance <Container>();
                                    container.SetId(cId);
                                    NodeId nodeId = NodeId.NewInstance("dummy", 1234);
                                    container.SetNodeId(nodeId);
                                    container.SetContainerToken(null);
                                    container.SetNodeHttpAddress("localhost:8042");
                                    this._enclosing._enclosing.GetContext().GetEventHandler().Handle(new TaskAttemptContainerAssignedEvent
                                                                                                         (@event.GetAttemptID(), container, null));
                                    this._enclosing._enclosing.concurrentRunningTasks++;
                                }
                                else
                                {
                                    Sharpen.Thread.Sleep(1000);
                                }
                            }
                            catch (Exception)
                            {
                                System.Console.Out.WriteLine("Returning, interrupted");
                                return;
                            }
                        }
                    }
예제 #5
0
 public virtual void Handle(ContainerAllocatorEvent @event)
 {
     this.allocator.Handle(@event);
 }
예제 #6
0
 public virtual void Handle(ContainerAllocatorEvent @event)
 {
 }