Author: mattmann
Date: Mon Aug 31 02:56:08 2015
New Revision: 1700189
URL: http://svn.apache.org/r1700189
Log:
Resolves both OODT-245 OODT-245 List results from the Resource Manager client
should be sorted alphabetically and OODT-248 Give user the ability to print a
detailed report on the load, capacity and queues of all nodes in the Resource
Manager.
Added:
oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/cli/action/GetNodeReportCliAction.java
oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/util/ResourceNodeComparator.java
Modified:
oodt/trunk/CHANGES.txt
oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/system/XmlRpcResourceManager.java
oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/system/XmlRpcResourceManagerClient.java
oodt/trunk/resource/src/main/resources/cmd-line-actions.xml
oodt/trunk/resource/src/main/resources/cmd-line-options.xml
Modified: oodt/trunk/CHANGES.txt
URL:
http://svn.apache.org/viewvc/oodt/trunk/CHANGES.txt?rev=1700189&r1=1700188&r2=1700189&view=diff
==============================================================================
--- oodt/trunk/CHANGES.txt (original)
+++ oodt/trunk/CHANGES.txt Mon Aug 31 02:56:08 2015
@@ -2,6 +2,12 @@ Apache OODT Change Log
======================
Release 0.10 - Current Development
+* OODT-245 List results from the Resource Manager client should be sorted
+ alphabetically (Gabe Resneck via mattmann)
+
+* OODT-248 Give user the ability to print a detailed report on the load,
capacity
+ and queues of all nodes in the Resource Manager (Gabe Resneck, mattmann)
+
* OODT-247 Resource Manager client should allow users to see what jobs are
currently in the queue (Gabe Resneck, mattmann)
Added:
oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/cli/action/GetNodeReportCliAction.java
URL:
http://svn.apache.org/viewvc/oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/cli/action/GetNodeReportCliAction.java?rev=1700189&view=auto
==============================================================================
---
oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/cli/action/GetNodeReportCliAction.java
(added)
+++
oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/cli/action/GetNodeReportCliAction.java
Mon Aug 31 02:56:08 2015
@@ -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.oodt.cas.resource.cli.action;
+
+//JDK imports
+import java.util.List;
+
+//OODT imports
+import org.apache.oodt.cas.cli.exception.CmdLineActionException;
+
+/**
+ * A {@link CmdLineAction} which returns name (all nodes will be displayed in
alphabetical order),
+ * load and capacity of all nodes, in addition to what queues that node draws
from.
+ *
+ */
+public class GetNodeReportCliAction extends ResourceCliAction {
+
+ @Override
+ public void execute(ActionMessagePrinter printer)
+ throws CmdLineActionException {
+ try {
+ String report = getClient().getNodeReport();
+ printer.println("Node Report: ");
+ printer.println(report);
+ printer.println();
+ } catch (Exception e) {
+ throw new CmdLineActionException("Failed to get node report: "
+ + e.getMessage(), e);
+ }
+ }
+}
Modified:
oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/system/XmlRpcResourceManager.java
URL:
http://svn.apache.org/viewvc/oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/system/XmlRpcResourceManager.java?rev=1700189&r1=1700188&r2=1700189&view=diff
==============================================================================
---
oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/system/XmlRpcResourceManager.java
(original)
+++
oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/system/XmlRpcResourceManager.java
Mon Aug 31 02:56:08 2015
@@ -42,6 +42,7 @@ import java.io.File;
import java.io.FileInputStream;
import java.net.MalformedURLException;
import java.net.URL;
+import java.util.Collections;
import java.util.Date;
import java.util.Hashtable;
import java.util.Iterator;
Modified:
oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/system/XmlRpcResourceManagerClient.java
URL:
http://svn.apache.org/viewvc/oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/system/XmlRpcResourceManagerClient.java?rev=1700189&r1=1700188&r2=1700189&view=diff
==============================================================================
---
oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/system/XmlRpcResourceManagerClient.java
(original)
+++
oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/system/XmlRpcResourceManagerClient.java
Mon Aug 31 02:56:08 2015
@@ -500,6 +500,19 @@ public class XmlRpcResourceManagerClient
return XmlRpcStructFactory.getJobListFromXmlRpc(queuedJobs);
}
+ public String getNodeReport() throws MonitorException{
+ String report = null;
+
+ try{
+ report = (String)client.execute("resourcemgr.getNodeReport", new
Vector<Object>());
+ }catch(Exception e){
+ throw new MonitorException(e.getMessage(), e);
+ }
+
+ return report;
+ }
+
+
public static String getReadableJobStatus(String status) {
if (status.equals(JobStatus.SUCCESS)) {
return "SUCCESS";
Added:
oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/util/ResourceNodeComparator.java
URL:
http://svn.apache.org/viewvc/oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/util/ResourceNodeComparator.java?rev=1700189&view=auto
==============================================================================
---
oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/util/ResourceNodeComparator.java
(added)
+++
oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/util/ResourceNodeComparator.java
Mon Aug 31 02:56:08 2015
@@ -0,0 +1,36 @@
+/*
+ * 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.oodt.cas.resource.util;
+
+// OODT imports
+import org.apache.oodt.cas.resource.structs.ResourceNode;
+
+// JDK imports
+import java.util.Comparator;
+
+public class ResourceNodeComparator implements Comparator<ResourceNode>{
+
+ public int compare(ResourceNode rn1, ResourceNode rn2){
+ String nodeId1 = rn1.getNodeId();
+ String nodeId2 = rn2.getNodeId();
+
+ return nodeId1.compareTo(nodeId2);
+ }
+
+}
Modified: oodt/trunk/resource/src/main/resources/cmd-line-actions.xml
URL:
http://svn.apache.org/viewvc/oodt/trunk/resource/src/main/resources/cmd-line-actions.xml?rev=1700189&r1=1700188&r2=1700189&view=diff
==============================================================================
--- oodt/trunk/resource/src/main/resources/cmd-line-actions.xml (original)
+++ oodt/trunk/resource/src/main/resources/cmd-line-actions.xml Mon Aug 31
02:56:08 2015
@@ -66,6 +66,10 @@
class="org.apache.oodt.cas.resource.cli.action.GetQueuedJobsCliAction">
<property name="description" value="Gets list of jobs
currently in the queue" />
</bean>
+ <bean id="getNodeReport"
+
class="org.apache.oodt.cas.resource.cli.action.GetNodeReportCliAction">
+ <property name="description" value="Gets name (all nodes will
be displayed in alphabetical order), load and capacity of all nodes, and their
queues." />
+ </bean>
<bean id="getQueuesWithNode"
class="org.apache.oodt.cas.resource.cli.action.GetQueuesWithNodeCliAction">
<property name="description" value="Gets list of queues which
contain given node" />
Modified: oodt/trunk/resource/src/main/resources/cmd-line-options.xml
URL:
http://svn.apache.org/viewvc/oodt/trunk/resource/src/main/resources/cmd-line-options.xml?rev=1700189&r1=1700188&r2=1700189&view=diff
==============================================================================
--- oodt/trunk/resource/src/main/resources/cmd-line-options.xml (original)
+++ oodt/trunk/resource/src/main/resources/cmd-line-options.xml Mon Aug 31
02:56:08 2015
@@ -58,6 +58,8 @@
<bean
class="org.apache.oodt.cas.cli.option.GroupSubOption"
p:option-ref="getQueuedJobs"
p:required="false" />
<bean
class="org.apache.oodt.cas.cli.option.GroupSubOption"
+ p:option-ref="getNodeReport"
p:required="false"/>
+ <bean
class="org.apache.oodt.cas.cli.option.GroupSubOption"
p:option-ref="addNode"
p:required="false" />
<bean
class="org.apache.oodt.cas.cli.option.GroupSubOption"
p:option-ref="removeNode"
p:required="false" />
@@ -619,5 +621,24 @@
</list>
</property>
</bean>
+
+ <bean id="getNodeReport"
class="org.apache.oodt.cas.cli.option.ActionCmdLineOption"
+ p:isSubOption="true">
+ <property name="shortOption" value="nreport" />
+ <property name="longOption" value="getNodeReport" />
+ <property name="description" value="Triggers getNodeReport
Action" />
+ <property name="hasArgs" value="false" />
+ <property name="staticArgs">
+ <list>
+ <value>getNodeReport</value>
+ </list>
+ </property>
+ <property name="requirementRules">
+ <list>
+ <bean
class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="getNodeReport"
p:relation="REQUIRED" />
+ </list>
+ </property>
+ </bean>
</beans>