You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by cw...@apache.org on 2013/01/02 20:02:19 UTC
svn commit: r1427906 [5/5] - in
/uima/sandbox/uima-ducc/trunk/uima-ducc-agent: main/ main/java/
main/java/org/ main/java/org/apache/ main/java/org/apache/uima/
main/java/org/apache/uima/ducc/ main/java/org/apache/uima/ducc/agent/
main/java/org/apache/u...
Added: uima/sandbox/uima-ducc/trunk/uima-ducc-agent/main/java/org/apache/uima/ducc/agent/processors/DefaultNodeMetricsProcessor.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-agent/main/java/org/apache/uima/ducc/agent/processors/DefaultNodeMetricsProcessor.java?rev=1427906&view=auto
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-agent/main/java/org/apache/uima/ducc/agent/processors/DefaultNodeMetricsProcessor.java (added)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-agent/main/java/org/apache/uima/ducc/agent/processors/DefaultNodeMetricsProcessor.java Wed Jan 2 19:02:18 2013
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+package org.apache.uima.ducc.agent.processors;
+
+import java.util.TreeMap;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+
+import org.apache.camel.Exchange;
+import org.apache.uima.ducc.agent.Agent;
+import org.apache.uima.ducc.agent.NodeAgent;
+import org.apache.uima.ducc.agent.metrics.collectors.DefaultNodeLoadAverageCollector;
+import org.apache.uima.ducc.agent.metrics.collectors.DefaultNodeMemoryCollector;
+import org.apache.uima.ducc.agent.metrics.collectors.NodeCpuCollector;
+import org.apache.uima.ducc.agent.metrics.collectors.NodeUsersCollector;
+import org.apache.uima.ducc.common.DuccNode;
+import org.apache.uima.ducc.common.Node;
+import org.apache.uima.ducc.common.agent.metrics.memory.NodeMemory;
+import org.apache.uima.ducc.common.node.metrics.NodeCpuInfo;
+import org.apache.uima.ducc.common.node.metrics.NodeLoadAverage;
+import org.apache.uima.ducc.common.node.metrics.NodeMetrics;
+import org.apache.uima.ducc.common.node.metrics.NodeUsersInfo;
+import org.apache.uima.ducc.common.utils.DuccLogger;
+import org.apache.uima.ducc.transport.event.NodeMetricsUpdateDuccEvent;
+
+
+public class DefaultNodeMetricsProcessor extends BaseProcessor implements
+ NodeMetricsProcessor {
+ private final NodeAgent agent;
+
+ private ExecutorService pool = Executors.newFixedThreadPool(1);
+
+ DuccLogger logger = DuccLogger.getLogger(this.getClass(), Agent.COMPONENT_NAME);
+
+ public DefaultNodeMetricsProcessor(final NodeAgent agent) throws Exception {
+ this.agent = agent;
+ }
+ public void process(Exchange exchange) throws Exception {
+ String methodName = "process";
+ try {
+
+ DefaultNodeMemoryCollector collector = new DefaultNodeMemoryCollector();
+ Future<NodeMemory> nmiFuture = pool.submit(collector);
+
+ DefaultNodeLoadAverageCollector loadAvgCollector =
+ new DefaultNodeLoadAverageCollector();
+ Future<NodeLoadAverage> loadFuture = pool.submit(loadAvgCollector);
+
+ NodeCpuCollector cpuCollector = new NodeCpuCollector();
+ Future<NodeCpuInfo> cpuFuture = pool.submit(cpuCollector);
+
+ NodeUsersCollector nodeUsersCollector = new NodeUsersCollector(agent, logger);
+ Future<TreeMap<String,NodeUsersInfo>> nuiFuture = pool.submit(nodeUsersCollector);
+
+ NodeMetrics nodeMetrics =
+ new NodeMetrics(agent.getIdentity(), nmiFuture.get(), loadFuture.get(),
+ cpuFuture.get(), nuiFuture.get());
+
+ //Node node = new DuccNode(new NodeIdentity(), nodeMetrics);
+ // jrc 2011-07-30 I think this needs to be agent.getIdentity(), not create a new identity.
+ Node node = new DuccNode(agent.getIdentity(), nodeMetrics);
+
+ logger.info(methodName, null, "... Agent "+node.getNodeIdentity().getName()+" Posting Users:"+
+ node.getNodeMetrics().getNodeUsersMap().size());
+
+ NodeMetricsUpdateDuccEvent event = new NodeMetricsUpdateDuccEvent(node,agent.getInventoryRef().size());
+ exchange.getIn().setBody(event, NodeMetricsUpdateDuccEvent.class);
+
+ } catch( Exception e) {
+ e.printStackTrace();
+ }
+
+ }
+
+}
Propchange: uima/sandbox/uima-ducc/trunk/uima-ducc-agent/main/java/org/apache/uima/ducc/agent/processors/DefaultNodeMetricsProcessor.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: uima/sandbox/uima-ducc/trunk/uima-ducc-agent/main/java/org/apache/uima/ducc/agent/processors/DefaultProcessMetricsProcessor.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-agent/main/java/org/apache/uima/ducc/agent/processors/DefaultProcessMetricsProcessor.java?rev=1427906&view=auto
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-agent/main/java/org/apache/uima/ducc/agent/processors/DefaultProcessMetricsProcessor.java (added)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-agent/main/java/org/apache/uima/ducc/agent/processors/DefaultProcessMetricsProcessor.java Wed Jan 2 19:02:18 2013
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+package org.apache.uima.ducc.agent.processors;
+
+import org.apache.camel.Exchange;
+import org.apache.uima.ducc.agent.NodeAgent;
+import org.apache.uima.ducc.transport.event.common.IDuccProcess;
+
+
+public class DefaultProcessMetricsProcessor implements ProcessMetricsProcessor {
+ private NodeAgent agent;
+ private IDuccProcess process;
+
+ public DefaultProcessMetricsProcessor( IDuccProcess process, NodeAgent agent) {
+ this.agent = agent;
+ this.process = process;
+ }
+ public void process(Exchange arg0) throws Exception {
+ }
+
+}
Propchange: uima/sandbox/uima-ducc/trunk/uima-ducc-agent/main/java/org/apache/uima/ducc/agent/processors/DefaultProcessMetricsProcessor.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: uima/sandbox/uima-ducc/trunk/uima-ducc-agent/main/java/org/apache/uima/ducc/agent/processors/LinuxNodeMetricsProcessor.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-agent/main/java/org/apache/uima/ducc/agent/processors/LinuxNodeMetricsProcessor.java?rev=1427906&view=auto
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-agent/main/java/org/apache/uima/ducc/agent/processors/LinuxNodeMetricsProcessor.java (added)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-agent/main/java/org/apache/uima/ducc/agent/processors/LinuxNodeMetricsProcessor.java Wed Jan 2 19:02:18 2013
@@ -0,0 +1,174 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+package org.apache.uima.ducc.agent.processors;
+
+import java.io.FileNotFoundException;
+import java.io.RandomAccessFile;
+import java.util.TreeMap;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+
+import org.apache.camel.Exchange;
+import org.apache.uima.ducc.agent.Agent;
+import org.apache.uima.ducc.agent.NodeAgent;
+import org.apache.uima.ducc.agent.metrics.collectors.NodeCpuCollector;
+import org.apache.uima.ducc.agent.metrics.collectors.NodeLoadAverageCollector;
+import org.apache.uima.ducc.agent.metrics.collectors.NodeMemInfoCollector;
+import org.apache.uima.ducc.agent.metrics.collectors.NodeUsersCollector;
+import org.apache.uima.ducc.common.DuccNode;
+import org.apache.uima.ducc.common.Node;
+import org.apache.uima.ducc.common.agent.metrics.memory.NodeMemory;
+import org.apache.uima.ducc.common.node.metrics.NodeCpuInfo;
+import org.apache.uima.ducc.common.node.metrics.NodeLoadAverage;
+import org.apache.uima.ducc.common.node.metrics.NodeMetrics;
+import org.apache.uima.ducc.common.node.metrics.NodeUsersInfo;
+import org.apache.uima.ducc.common.utils.DuccLogger;
+import org.apache.uima.ducc.transport.event.NodeMetricsUpdateDuccEvent;
+
+
+public class LinuxNodeMetricsProcessor extends BaseProcessor implements
+ NodeMetricsProcessor {
+ DuccLogger logger = DuccLogger.getLogger(this.getClass(), Agent.COMPONENT_NAME);
+ public static String[] MeminfoTargetFields = new String[] {"MemTotal:","MemFree:","SwapTotal:","SwapFree:"};
+
+ private NodeAgent agent;
+ private static final int PROCFILES = 8;
+ private final ExecutorService pool;
+ private RandomAccessFile memInfoFile;
+ private RandomAccessFile loadAvgFile;
+ private Node node;
+ private int swapThreshold = 0;
+ public LinuxNodeMetricsProcessor(NodeAgent agent, String memInfoFilePath,
+ String loadAvgFilePath) throws FileNotFoundException {
+ super();
+ this.agent = agent;
+ pool = Executors.newFixedThreadPool(PROCFILES);
+ // open files and keep them open until stop() is called
+ memInfoFile = new RandomAccessFile(memInfoFilePath, "r");
+ loadAvgFile = new RandomAccessFile(loadAvgFilePath, "r");
+ node = new DuccNode(agent.getIdentity(), null);
+ if ( System.getProperty("ducc.node.min.swap.threshold") != null ) {
+ try {
+ swapThreshold = Integer.valueOf(System.getProperty("ducc.node.min.swap.threshold"));
+ logger.info("ctor", null, "Ducc Node Min Swap Threshold:"+swapThreshold);
+ } catch( Exception e) {
+ }
+ }
+ }
+
+ public void stop() {
+ try {
+ if (memInfoFile != null) {
+ memInfoFile.close();
+ }
+ if (loadAvgFile != null) {
+ loadAvgFile.close();
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Collects node's metrics and dumps it to a JMS topic. Currently collects
+ * memory utilization from /proc/meminfo and average load from
+ * /proc/loadavg. This method is called from NodeAgentStatsGenerator at
+ * fixed intervals.
+ *
+ */
+ public void process(Exchange e) {
+ String methodName = "process";
+ try {
+
+
+ NodeMemInfoCollector memCollector = new NodeMemInfoCollector(MeminfoTargetFields);
+ Future<NodeMemory> nmiFuture = pool.submit(memCollector);
+ NodeLoadAverageCollector loadAvgCollector = new NodeLoadAverageCollector(
+ loadAvgFile, 5, 0);
+ Future<NodeLoadAverage> loadFuture = pool.submit(loadAvgCollector);
+ NodeCpuCollector cpuCollector = new NodeCpuCollector();
+ Future<NodeCpuInfo> cpuFuture = pool.submit(cpuCollector);
+ e.getIn().setHeader("node", agent.getIdentity().getName());
+ NodeMemory memInfo = nmiFuture.get();
+ NodeUsersCollector nodeUsersCollector = new NodeUsersCollector(agent, logger);
+
+ logger.info(methodName, null, "... Agent Collecting User Processes");
+
+ Future<TreeMap<String,NodeUsersInfo>> nuiFuture =
+ pool.submit(nodeUsersCollector);
+
+ NodeMetrics nodeMetrics = new NodeMetrics(agent.getIdentity(), memInfo, loadFuture.get(),
+ cpuFuture.get(), nuiFuture.get());
+
+ Node node = new DuccNode(agent.getIdentity(), nodeMetrics);
+ ((DuccNode)node).duccLingExists(agent.duccLingExists());
+ ((DuccNode)node).runWithDuccLing(agent.runWithDuccLing());
+ logger.info(methodName, null, "... Agent "+node.getNodeIdentity().getName()+" Posting Memory:"
+ + node.getNodeMetrics().getNodeMemory().getMemTotal()+
+ " Memory Free:"+node.getNodeMetrics().getNodeMemory().getMemFree()+
+ " Swap Total:"+node.getNodeMetrics().getNodeMemory().getSwapTotal()+
+ " Swap Free:"+node.getNodeMetrics().getNodeMemory().getSwapFree()+
+ " Low Swap Threshold Defined in ducc.properties:"+swapThreshold);
+ logger.trace(methodName, null, "... Agent "+node.getNodeIdentity().getName()+" Posting Users:"+
+ node.getNodeMetrics().getNodeUsersMap().size());
+ // Check if swap free is less than defined minimum threshold (check ducc.properties)
+ if ( swapThreshold > 0 && ( node.getNodeMetrics().getNodeMemory().getSwapFree() < swapThreshold)) {
+ agent.killProcessDueToLowSwapSpace(swapThreshold);
+ }
+ NodeMetricsUpdateDuccEvent updateEvent = new NodeMetricsUpdateDuccEvent(node,agent.getInventoryRef().size());
+ e.getIn().setBody(updateEvent, NodeMetricsUpdateDuccEvent.class);
+
+ // Add header property which will allow the agent to filter in its pings
+// Map<String, Object> headers = new HashMap<String, Object>();
+// headers.put(agent.configurationFactory.agentPingSelectorName,
+// agent.getIdentity().getIp());
+
+ // Dispatch ping to self via common agent ping topic. A property in the header
+ // allow the agent to filter in its pings
+// agent.
+// configurationFactory.
+// getAgentPingDispatcher().
+// dispatch(new AgentPingEvent(EventType.AGENT_PING, node), headers);
+
+ } catch (Exception ex) {
+ logger.error(methodName, null, ex, new Object[] { "Agent" });
+ }
+ }
+
+ public void testMemInfo() throws Exception {
+ NodeMemInfoCollector memCollector = new NodeMemInfoCollector(MeminfoTargetFields);// memCollector = new NodeMemInfoCollector(
+ Future<NodeMemory> nmi = pool.submit(memCollector);
+ NodeMemory mi = nmi.get(); // wait for the metrics
+ System.out.println("....... Got the MemInfo - Total memory:"
+ + mi.getMemTotal());
+
+ }
+
+ public void testLoadAvg() throws Exception {
+ NodeLoadAverageCollector loadCollector = new NodeLoadAverageCollector(
+ loadAvgFile, 5, 0);
+ Future<NodeLoadAverage> nlai = pool.submit(loadCollector);
+ NodeLoadAverage lai = nlai.get(); // wait for the metrics
+ System.out.println("....... Got the LoadAverage Info LoadAvg1:"
+ + lai.getLoadAvg1() + " " + lai.getLoadAvg5() + " "
+ + lai.getLoadAvg15());
+
+ }
+}
Propchange: uima/sandbox/uima-ducc/trunk/uima-ducc-agent/main/java/org/apache/uima/ducc/agent/processors/LinuxNodeMetricsProcessor.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: uima/sandbox/uima-ducc/trunk/uima-ducc-agent/main/java/org/apache/uima/ducc/agent/processors/LinuxProcessMetricsProcessor.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-agent/main/java/org/apache/uima/ducc/agent/processors/LinuxProcessMetricsProcessor.java?rev=1427906&view=auto
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-agent/main/java/org/apache/uima/ducc/agent/processors/LinuxProcessMetricsProcessor.java (added)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-agent/main/java/org/apache/uima/ducc/agent/processors/LinuxProcessMetricsProcessor.java Wed Jan 2 19:02:18 2013
@@ -0,0 +1,147 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+package org.apache.uima.ducc.agent.processors;
+
+import java.io.FileNotFoundException;
+import java.io.RandomAccessFile;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+
+import org.apache.camel.Exchange;
+import org.apache.uima.ducc.agent.NodeAgent;
+import org.apache.uima.ducc.agent.launcher.ManagedProcess;
+import org.apache.uima.ducc.agent.metrics.collectors.DuccGarbageStatsCollector;
+import org.apache.uima.ducc.agent.metrics.collectors.ProcessCpuUsageCollector;
+import org.apache.uima.ducc.agent.metrics.collectors.ProcessResidentMemoryCollector;
+import org.apache.uima.ducc.common.agent.metrics.cpu.ProcessCpuUsage;
+import org.apache.uima.ducc.common.agent.metrics.memory.ProcessResidentMemory;
+import org.apache.uima.ducc.common.node.metrics.ProcessGarbageCollectionStats;
+import org.apache.uima.ducc.common.utils.DuccLogger;
+import org.apache.uima.ducc.transport.event.common.IDuccProcess;
+import org.apache.uima.ducc.transport.event.common.IDuccProcess.ReasonForStoppingProcess;
+import org.apache.uima.ducc.transport.event.common.IProcessState.ProcessState;
+
+
+public class LinuxProcessMetricsProcessor extends BaseProcessor
+implements ProcessMetricsProcessor {
+ private RandomAccessFile statmFile;
+ private RandomAccessFile nodeStatFile;
+ private RandomAccessFile processStatFile;
+ private final ExecutorService pool;
+ private IDuccProcess process;
+ private DuccGarbageStatsCollector gcStatsCollector;
+ private int blockSize = 4096; // default, OS specific
+ private DuccLogger logger;
+ private ManagedProcess managedProcess;
+ private NodeAgent agent;
+ private int fudgeFactor = 5; // default is 5%
+
+ public LinuxProcessMetricsProcessor(DuccLogger logger, IDuccProcess process, NodeAgent agent,String statmFilePath, String nodeStatFilePath, String processStatFilePath, ManagedProcess managedProcess) throws FileNotFoundException{
+ this.logger = logger;
+ statmFile = new RandomAccessFile(statmFilePath, "r");
+ nodeStatFile = new RandomAccessFile(nodeStatFilePath, "r");
+ processStatFile = new RandomAccessFile(processStatFilePath, "r");
+ this.managedProcess = managedProcess;
+ this.agent = agent;
+ pool = Executors.newFixedThreadPool(3);
+ this.process = process;
+ gcStatsCollector = new DuccGarbageStatsCollector(logger, process);
+ // read the block size from ducc.properties
+ if ( System.getProperty("os.page.size") != null ) {
+ try {
+ blockSize = Integer.parseInt(System.getProperty("os.page.size"));
+ } catch(NumberFormatException e) {
+ e.printStackTrace();
+ }
+ }
+ if ( System.getProperty("ducc.agent.share.size.fudge.factor") != null ) {
+ try {
+ fudgeFactor = Integer.parseInt(System.getProperty("ducc.agent.share.size.fudge.factor"));
+ } catch(NumberFormatException e) {
+ e.printStackTrace();
+ }
+ }
+
+ }
+ public void close() {
+ try {
+ if (statmFile != null) {
+ statmFile.close();
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ public void process(Exchange e) {
+ if ( process.getProcessState().equals(ProcessState.Initializing) ||
+ process.getProcessState().equals(ProcessState.Running))
+ try {
+ ProcessResidentMemoryCollector collector =
+ new ProcessResidentMemoryCollector(statmFile, 2, 0);
+ Future<ProcessResidentMemory> prm = pool.submit(collector);
+
+ ProcessCpuUsageCollector processCpuUsageCollector =
+ new ProcessCpuUsageCollector(logger, process.getPID(), processStatFile,42,0);
+ Future<ProcessCpuUsage> processCpuUsage = pool.submit(processCpuUsageCollector);
+
+ logger.trace("process", null, "----------- PID:"+process.getPID()+" Cumulative CPU Time (jiffies):"+processCpuUsage.get().getTotalJiffies());
+ // Publish cumulative CPU usage
+ process.setCpuTime(processCpuUsage.get().getTotalJiffies());
+ // if the fudgeFactor is negative, don't check if the process exceeded its
+ // memory assignment.
+
+ if ( fudgeFactor > -1 && managedProcess.getProcessMemoryAssignment() > 0 ) {
+ // RSS is in terms of pages(blocks) which size is system dependent. Default 4096 bytes
+ long rss = (prm.get().get()*(blockSize/1024))/1024; // normalize RSS into MB
+ logger.trace("process", null, "*** Process with PID:"+managedProcess.getPid()+ " Assigned Memory (MB): "+ managedProcess.getProcessMemoryAssignment()+" MBs. Current RSS (MB):"+rss);
+ // check if process resident memory exceeds its memory assignment calculate in the PM
+ if ( rss > managedProcess.getProcessMemoryAssignment() ) {
+ logger.error("process", null, "\n\n********************************************************\n\tProcess with PID:"+managedProcess.getPid()+ " Exceeded its max memory assignment (including a fudge factor) of "+ managedProcess.getProcessMemoryAssignment()+" MBs. This Process Resident Memory Size: "+rss+" MBs .Killing process ...\n********************************************************\n\n" );
+ try {
+ managedProcess.kill(); // mark it for death
+ process.setReasonForStoppingProcess(ReasonForStoppingProcess.ExceededShareSize.toString());
+ agent.stopProcess(process);
+ } catch( Exception ee) {
+ logger.error("process", null,ee);
+ }
+ return;
+ }
+ }
+ // Publish resident memory
+ process.setResidentMemory((prm.get().get()*blockSize));
+ ProcessGarbageCollectionStats gcStats =
+ gcStatsCollector.collect();
+ process.setGarbageCollectionStats( gcStats );
+ logger.info("process", null, "PID:"+process.getPID()+" Total GC Collection Count :" + gcStats.getCollectionCount()+ " Total GC Collection Time :" + gcStats.getCollectionTime());
+
+ } catch( Exception ex) {
+ ex.printStackTrace();
+ }
+
+ }
+ public static void main(String[] args) {
+ try {
+// LinuxProcessMetricsProcessor p = new LinuxProcessMetricsProcessor(null,null,args[0]);
+// p.process(null);
+ } catch( Exception e) {
+ e.printStackTrace();
+ }
+ }
+}
Propchange: uima/sandbox/uima-ducc/trunk/uima-ducc-agent/main/java/org/apache/uima/ducc/agent/processors/LinuxProcessMetricsProcessor.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: uima/sandbox/uima-ducc/trunk/uima-ducc-agent/main/java/org/apache/uima/ducc/agent/processors/NodeInventoryProcessor.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-agent/main/java/org/apache/uima/ducc/agent/processors/NodeInventoryProcessor.java?rev=1427906&view=auto
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-agent/main/java/org/apache/uima/ducc/agent/processors/NodeInventoryProcessor.java (added)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-agent/main/java/org/apache/uima/ducc/agent/processors/NodeInventoryProcessor.java Wed Jan 2 19:02:18 2013
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+package org.apache.uima.ducc.agent.processors;
+
+import java.util.HashMap;
+
+import org.apache.camel.Processor;
+import org.apache.uima.ducc.common.utils.id.DuccId;
+import org.apache.uima.ducc.transport.event.common.IDuccProcess;
+
+
+public interface NodeInventoryProcessor extends Processor {
+ public HashMap<DuccId, IDuccProcess> getInventory();
+}
Propchange: uima/sandbox/uima-ducc/trunk/uima-ducc-agent/main/java/org/apache/uima/ducc/agent/processors/NodeInventoryProcessor.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: uima/sandbox/uima-ducc/trunk/uima-ducc-agent/main/java/org/apache/uima/ducc/agent/processors/NodeMetricsProcessor.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-agent/main/java/org/apache/uima/ducc/agent/processors/NodeMetricsProcessor.java?rev=1427906&view=auto
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-agent/main/java/org/apache/uima/ducc/agent/processors/NodeMetricsProcessor.java (added)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-agent/main/java/org/apache/uima/ducc/agent/processors/NodeMetricsProcessor.java Wed Jan 2 19:02:18 2013
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+package org.apache.uima.ducc.agent.processors;
+
+import org.apache.camel.Processor;
+
+public interface NodeMetricsProcessor extends Processor {
+
+}
Propchange: uima/sandbox/uima-ducc/trunk/uima-ducc-agent/main/java/org/apache/uima/ducc/agent/processors/NodeMetricsProcessor.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: uima/sandbox/uima-ducc/trunk/uima-ducc-agent/main/java/org/apache/uima/ducc/agent/processors/ProcessLifecycleProcessor.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-agent/main/java/org/apache/uima/ducc/agent/processors/ProcessLifecycleProcessor.java?rev=1427906&view=auto
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-agent/main/java/org/apache/uima/ducc/agent/processors/ProcessLifecycleProcessor.java (added)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-agent/main/java/org/apache/uima/ducc/agent/processors/ProcessLifecycleProcessor.java Wed Jan 2 19:02:18 2013
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+package org.apache.uima.ducc.agent.processors;
+
+import org.apache.camel.Exchange;
+
+public class ProcessLifecycleProcessor extends BaseProcessor {
+
+ private static final String windowsCommandSeparator = "&";
+ private static final String nixCommandSeparator = " ; ";
+ public ProcessLifecycleProcessor() {
+ super();
+ }
+ /**
+ * Method called by Camel if a message is of type:
+
+ * <ul> StartProcessEvent</ul>
+ * <ul> StopProcessEvent</ul>
+ * <ul> PurgeProcessEvent</ul>
+ *
+ * This method checks if a message contains this host name (or IP) as a target. If this agent
+ * is not a target, the message is ignored.
+ *
+ */
+ public void process(final Exchange e) throws Exception {
+ System.out.println("... Agent Received Request");
+ }
+
+}
Propchange: uima/sandbox/uima-ducc/trunk/uima-ducc-agent/main/java/org/apache/uima/ducc/agent/processors/ProcessLifecycleProcessor.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: uima/sandbox/uima-ducc/trunk/uima-ducc-agent/main/java/org/apache/uima/ducc/agent/processors/ProcessMetricsProcessor.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-agent/main/java/org/apache/uima/ducc/agent/processors/ProcessMetricsProcessor.java?rev=1427906&view=auto
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-agent/main/java/org/apache/uima/ducc/agent/processors/ProcessMetricsProcessor.java (added)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-agent/main/java/org/apache/uima/ducc/agent/processors/ProcessMetricsProcessor.java Wed Jan 2 19:02:18 2013
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+package org.apache.uima.ducc.agent.processors;
+
+import org.apache.camel.Processor;
+
+public interface ProcessMetricsProcessor extends Processor {
+
+}
Propchange: uima/sandbox/uima-ducc/trunk/uima-ducc-agent/main/java/org/apache/uima/ducc/agent/processors/ProcessMetricsProcessor.java
------------------------------------------------------------------------------
svn:eol-style = native