You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hama.apache.org by ed...@apache.org on 2008/09/23 05:12:37 UTC

svn commit: r698070 - in /incubator/hama/trunk/src/java/org/apache/hama: AbstractMatrix.java DenseMatrix.java util/JobManager.java

Author: edwardyoon
Date: Mon Sep 22 20:12:36 2008
New Revision: 698070

URL: http://svn.apache.org/viewvc?rev=698070&view=rev
Log:
Remove job executor to util package

Added:
    incubator/hama/trunk/src/java/org/apache/hama/util/JobManager.java
Modified:
    incubator/hama/trunk/src/java/org/apache/hama/AbstractMatrix.java
    incubator/hama/trunk/src/java/org/apache/hama/DenseMatrix.java

Modified: incubator/hama/trunk/src/java/org/apache/hama/AbstractMatrix.java
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/src/java/org/apache/hama/AbstractMatrix.java?rev=698070&r1=698069&r2=698070&view=diff
==============================================================================
--- incubator/hama/trunk/src/java/org/apache/hama/AbstractMatrix.java (original)
+++ incubator/hama/trunk/src/java/org/apache/hama/AbstractMatrix.java Mon Sep 22 20:12:36 2008
@@ -28,9 +28,6 @@
 import org.apache.hadoop.hbase.client.HTable;
 import org.apache.hadoop.hbase.io.Cell;
 import org.apache.hadoop.hbase.util.Bytes;
-import org.apache.hadoop.mapred.JobClient;
-import org.apache.hadoop.mapred.JobConf;
-import org.apache.hadoop.mapred.RunningJob;
 import org.apache.hama.io.VectorUpdate;
 import org.apache.hama.util.Numeric;
 import org.apache.log4j.Logger;
@@ -80,17 +77,6 @@
     this.admin.createTable(this.tableDesc);
   }
 
-  public void execute(JobConf jobConf, Matrix result) throws IOException {
-    RunningJob rJob = JobClient.runJob(jobConf);
-    // TODO : When HADOOP-4043 done, we should change this.
-    long rows = rJob.getCounters().findCounter(
-        "org.apache.hadoop.mapred.Task$Counter", 8, "REDUCE_OUTPUT_RECORDS")
-        .getCounter();
-    // TODO : Thinking about more efficient method.
-    int columns = result.getRow(0).size();
-    result.setDimension((int) rows, columns);
-  }
-
   /** {@inheritDoc} */
   public double get(int i, int j) throws IOException {
     double result = -1;

Modified: incubator/hama/trunk/src/java/org/apache/hama/DenseMatrix.java
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/src/java/org/apache/hama/DenseMatrix.java?rev=698070&r1=698069&r2=698070&view=diff
==============================================================================
--- incubator/hama/trunk/src/java/org/apache/hama/DenseMatrix.java (original)
+++ incubator/hama/trunk/src/java/org/apache/hama/DenseMatrix.java Mon Sep 22 20:12:36 2008
@@ -37,6 +37,7 @@
 import org.apache.hama.io.VectorMapWritable;
 import org.apache.hama.io.VectorUpdate;
 import org.apache.hama.mapred.MatrixReduce;
+import org.apache.hama.util.JobManager;
 import org.apache.hama.util.Numeric;
 import org.apache.hama.util.RandomVariable;
 
@@ -143,7 +144,7 @@
         IntWritable.class, DenseVector.class, jobConf);
     MatrixReduce.initJob(result.getName(), Add1DLayoutReduce.class, jobConf);
 
-    execute(jobConf, result);
+    JobManager.execute(jobConf, result);
     return result;
   }
 
@@ -181,7 +182,7 @@
     Mult1DLayoutMap.initJob(this.getName(), B.getName(),
         Mult1DLayoutMap.class, IntWritable.class, DenseVector.class, jobConf);
     MatrixReduce.initJob(result.getName(), Mult1DLayoutReduce.class, jobConf);
-    execute(jobConf, result);
+    JobManager.execute(jobConf, result);
     return result;
   }
 

Added: incubator/hama/trunk/src/java/org/apache/hama/util/JobManager.java
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/src/java/org/apache/hama/util/JobManager.java?rev=698070&view=auto
==============================================================================
--- incubator/hama/trunk/src/java/org/apache/hama/util/JobManager.java (added)
+++ incubator/hama/trunk/src/java/org/apache/hama/util/JobManager.java Mon Sep 22 20:12:36 2008
@@ -0,0 +1,42 @@
+/**
+ * Copyright 2007 The Apache Software Foundation
+ *
+ * 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.hama.util;
+
+import java.io.IOException;
+
+import org.apache.hadoop.mapred.JobClient;
+import org.apache.hadoop.mapred.JobConf;
+import org.apache.hadoop.mapred.RunningJob;
+import org.apache.hama.Matrix;
+
+public class JobManager {
+  
+  public static void execute(JobConf jobConf, Matrix result) throws IOException {
+    RunningJob rJob = JobClient.runJob(jobConf);
+    // TODO : When HADOOP-4043 done, we should change this.
+    long rows = rJob.getCounters().findCounter(
+        "org.apache.hadoop.mapred.Task$Counter", 8, "REDUCE_OUTPUT_RECORDS")
+        .getCounter();
+    // TODO : Thinking about more efficient method.
+    int columns = result.getRow(0).size();
+    result.setDimension((int) rows, columns);
+  }
+  
+}