public override NodeState Evaluate() { i = 0; while (i < nodes.Count) { if (nodes[i].isPhysicsBased & !BehaviorTreeManager.IsFixedTime()) { return(SetState(NodeState.RUNNING)); } NodeState status = nodes[i].Evaluate(); if (status.Equals(NodeState.SUCCESS)) { // The current node was a success, lets continue to the next. i++; } else// if(status.Equals(NodeState.FAILURE) || status.Equals(NodeState.RUNNING)) { // Keep current index and stop the loop with the current status. return(SetState(status)); } } // If this code path is reached, then all nodes where a success. return(SetState(NodeState.SUCCESS)); }
public bool SetNodeState(ZigBeeNodeState state) { if (NodeState.Equals(state)) { return(false); } Log.Debug("{IeeeAddress}: Node state updated from {oldState} to {newState}", IeeeAddress, NodeState, state); NodeState = state; return(true); }
/// <exception cref="System.Exception"/> public virtual void NMwaitForState(NodeId nodeid, NodeState finalState) { RMNode node = GetRMContext().GetRMNodes()[nodeid]; NUnit.Framework.Assert.IsNotNull("node shouldn't be null", node); int timeoutSecs = 0; while (!finalState.Equals(node.GetState()) && timeoutSecs++ < 20) { System.Console.Out.WriteLine("Node State is : " + node.GetState() + " Waiting for state : " + finalState); Sharpen.Thread.Sleep(500); } System.Console.Out.WriteLine("Node State is : " + node.GetState()); NUnit.Framework.Assert.AreEqual("Node state is not correct (timedout)", finalState , node.GetState()); }
public override NodeState Evaluate() { i = 0; while (i < nodes.Count) { NodeState status = nodes[i].Evaluate(); if (status.Equals(NodeState.FAILURE)) { // The current node was a failure, lets continue to the next. i++; } else// if(status.Equals(NodeState.RUNNING) || status.Equals(NodeState.SUCCESS)) { // Keep current index and stop the loop with the current status. return(SetState(status)); } } // If this code path is reached, then all nodes where a failure. return(SetState(NodeState.FAILURE)); }
protected override void Render(HtmlBlock.Block html) { html.(typeof(MetricsOverviewTable)); ResourceScheduler sched = rm.GetResourceScheduler(); string type = $(YarnWebParams.NodeState); string labelFilter = $(YarnWebParams.NodeLabel, CommonNodeLabelsManager.Any).Trim (); Hamlet.TBODY <Hamlet.TABLE <Org.Apache.Hadoop.Yarn.Webapp.Hamlet.Hamlet> > tbody = html .Table("#nodes").Thead().Tr().Th(".nodelabels", "Node Labels").Th(".rack", "Rack" ).Th(".state", "Node State").Th(".nodeaddress", "Node Address").Th(".nodehttpaddress" , "Node HTTP Address").Th(".lastHealthUpdate", "Last health-update").Th(".healthReport" , "Health-report").Th(".containers", "Containers").Th(".mem", "Mem Used").Th(".mem" , "Mem Avail").Th(".vcores", "VCores Used").Th(".vcores", "VCores Avail").Th(".nodeManagerVersion" , "Version").().().Tbody(); NodeState stateFilter = null; if (type != null && !type.IsEmpty()) { stateFilter = NodeState.ValueOf(StringUtils.ToUpperCase(type)); } ICollection <RMNode> rmNodes = this.rm.GetRMContext().GetRMNodes().Values; bool isInactive = false; if (stateFilter != null) { switch (stateFilter) { case NodeState.Decommissioned: case NodeState.Lost: case NodeState.Rebooted: { rmNodes = this.rm.GetRMContext().GetInactiveRMNodes().Values; isInactive = true; break; } default: { Log.Debug("Unexpected state filter for inactive RM node"); break; } } } foreach (RMNode ni in rmNodes) { if (stateFilter != null) { NodeState state = ni.GetState(); if (!stateFilter.Equals(state)) { continue; } } else { // No filter. User is asking for all nodes. Make sure you skip the // unhealthy nodes. if (ni.GetState() == NodeState.Unhealthy) { continue; } } // Besides state, we need to filter label as well. if (!labelFilter.Equals(RMNodeLabelsManager.Any)) { if (labelFilter.IsEmpty()) { // Empty label filter means only shows nodes without label if (!ni.GetNodeLabels().IsEmpty()) { continue; } } else { if (!ni.GetNodeLabels().Contains(labelFilter)) { // Only nodes have given label can show on web page. continue; } } } NodeInfo info = new NodeInfo(ni, sched); int usedMemory = (int)info.GetUsedMemory(); int availableMemory = (int)info.GetAvailableMemory(); Hamlet.TR <Hamlet.TBODY <Hamlet.TABLE <Org.Apache.Hadoop.Yarn.Webapp.Hamlet.Hamlet> > > row = tbody.Tr().Td(StringUtils.Join(",", info.GetNodeLabels())).Td(info.GetRack ()).Td(info.GetState()).Td(info.GetNodeId()); if (isInactive) { row.Td().("N/A").(); } else { string httpAddress = info.GetNodeHTTPAddress(); row.Td().A("//" + httpAddress, httpAddress).(); } row.Td().Br().$title(info.GetLastHealthUpdate().ToString()).().(Times.Format(info .GetLastHealthUpdate())).().Td(info.GetHealthReport()).Td(info.GetNumContainers( ).ToString()).Td().Br().$title(usedMemory.ToString()).().(StringUtils.ByteDesc(usedMemory * BytesInMb)).().Td().Br().$title(availableMemory.ToString()).().(StringUtils.ByteDesc (availableMemory * BytesInMb)).().Td(info.GetUsedVirtualCores().ToString()).Td(info .GetAvailableVirtualCores().ToString()).Td(ni.GetNodeManagerVersion()).(); } tbody.().(); }